#include <stdio.h>
#include <string.h>
_Bool IS(int year){ //是否是闰年
return (year%4==0 && year%100!=0) || year%400==0;
}
int Year(int year){ //闰年366天,非闰年365天
if(IS(year))
return 366;
else
return 365;
}
int main(){
int a[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}
};
char Month[13][12] = {
"", "January", "February", "March", "April", "May", "June", "July",
"August", "September", "October", "November", "December"
};
char Week[7][9] = {
"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday"
};
int year, month, week, day;
int num, row, i, y;
char M[12];
while(scanf("%d %s %d", &day, M, &year) != EOF){
num=0;
y=1;
while(y<year){ //公元1年到输入年份之间经过的天数
num += Year(y);
y++;
}
for(i=0; i<=13; i++){ //根据输入的英文月份找到第几月
if(!strcmp(M, Month[i]))
month = i;
}
row = IS(year);
for(i=0; i<=month; i++){ //计算该年份经过的天数
if(i==month)
num += day;
else
num += a[row][i];
}
week = num % 7;
printf("%s\n", Week[week]);
}
return 0;
}