#include <iostream>
#include <functional>
#include <iostream>
#include <string.h>
#include <stdlib.h>
using namespace std;
int isPyear(int y){
    return (y%4==0 && y%100!=0)||(y%400==0);
}
int coudis(int d){
	int daysEach[2][13]={{0,31,28,31,30,31,30,31,31,30,31,30,31},{0,31,29,31,30,31,30,31,31,30,31,30,31}};
	int year=d/10000;
	int month=d/100%100;
	int day=d%100;
	int dis=0;
	for(int i=0;i<year;i++){
		if(isPyear(i)) dis+=366;
		else dis+=365;
	}
	for(int j=1;j<month;j++){
		dis+=daysEach[isPyear(year)][j];
	}
	dis+=day;
	return dis;
}
int main(){
int day,year;
char mon[10];
int month;
while(cin>>day>>mon>>year){
	if(strcmp(mon,"January")==0) month=1;
	else if(strcmp(mon,"February")==0) month=2;
	else if(strcmp(mon,"March")==0) month=3;
	else if(strcmp(mon,"April")==0) month=4;
	else if(strcmp(mon,"May")==0) month=5;
	else if(strcmp(mon,"June")==0) month=6;
	else if(strcmp(mon,"July")==0) month=7;
	else if(strcmp(mon,"August")==0) month=8;
	else if(strcmp(mon,"September")==0) month=9;
	else if(strcmp(mon,"October")==0) month=10;
	else if(strcmp(mon,"November")==0) month=11;
	else if(strcmp(mon,"December")==0) month=12;
	else {
		cout<<"month input is wrong";
		exit(0);
	}
	int day_thatd=year*10000+month*100+day;
	int day_today=20230225;
	int flag=0;
	int a;
	if(day_thatd>day_today) {
	  flag=1;// the case that day is in the future
	  a=coudis(day_thatd)-coudis(day_today);}
	else a=coudis(day_today)-coudis(day_thatd);
	int w=0;
    w=a%7;
    // today is Saturday
    if(flag){
    	if(w==0) cout<<"Saturday";
    	else if(w==1) cout<<"Sunday";
    	else if(w==2) cout<<"Monday";
    	else if(w==3) cout<<"Tuesday";
    	else if(w==4) cout<<"Wednesday";
    	else if(w==5) cout<<"Thursday";
    	else cout<<"Friday";
    	cout<<endl;
	}
	else{
		if(w==0) cout<<"Saturday";
    	else if(w==1) cout<<"Friday";
    	else if(w==2) cout<<"Thursday";
    	else if(w==3) cout<<"Wednesday";
    	else if(w==4) cout<<"Tuesday";
    	else if(w==5) cout<<"Monday";
    	else cout<<"Sunday";
    	cout<<endl;
	}
}

}