#include<string>
#include<iostream>

using namespace std;

int main()
{
	int n;	cin>>n;
	string s;
	int runner=0,out=0,score=0;
	while(cin>>s){
		if(s=="HIT"){
			runner<<=1;
			if(runner&8)runner&=~8,score++;
			runner|=1;
		}
		else if(s=="HOMERUN"){
			for(int i=0;i<3;i++){
				runner<<=1;
				if(runner&8)runner&=~8,score++;
			}
			score++;
		}
		else{
			out++;
			if(out==3)	cout<<score<<endl,runner=out=score=0;
		}
	}
	return 0;
}
#include <iostream>
#include <string>
using namespace std;
string A[] = { "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday",
"Wednesday" };
int D[] = { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
int main()
{
    int m, d, B[13];
    B[0] = 1;
    for (int i = 1; i <= 12; ++i) B[i] = B[i-1] + D[i];
    while (cin >> m >> d) {
        if (!(m | d)) break;
        int t = B[m-1] + d - 2;
        cout << A[t%7] << endl;
    }
    return 0;
}