#include <iostream>
#include <string.h>

using namespace std;

int daytab[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
}
};

bool isLeapYear(int x){
	return (x % 4 ==0 && x % 100 != 0) || (x % 400 == 0);
}

char week_name[7][20]={
    "Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"
};

char month_name[13][20]={
    "","January","February","March","April","May","June","July","August",
    "September","October","November","December"
};

int main(){
	int d,y,m,sum = 0;
	char mon[10];
	scanf("%d%s%d",&d,&mon,&y);
	
	for(int i = 0;i < 14;i ++){
		if(strcmp(month_name[i],mon) == 0){
			m = i;
			break;
		}
	}
	
	for(int i = 1;i < y;i ++){
		if(isLeapYear(i)){
			sum += 366;
		}else sum += 365;
	}
	
	
	for(int i = 0;i < m;i ++){
		sum += daytab[isLeapYear(y)][i];
	}
	
	
	sum = sum + d;
	
	cout << week_name[(sum % 7)] << endl;
	return 0;
}