#include <stdio.h>
#include<stdbool.h>
#include<string.h>
// 判断闰年函数
bool IsRunYear(int year) {
return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
}
// 平润年各月天数
int table[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 NumberYear(int year) {
if (IsRunYear(year) == 0)
return 365;
else
return 366;
}
// 周的英文表示
char WeekTable[7][13] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
// 月的英文表示
char monthtable[12][13] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
int main() {
int year, month = 0, day, number = 0;
char monthe[13];
while ((scanf("%02d%s%04d", &day, monthe, &year)) != EOF) {
while (strcmp(monthe, monthtable[month])) {
month++;
}
month++;
number = 0;
int row = IsRunYear(year);
while (year != 1) {
number += NumberYear(--year);
}
for (int i = 0; i < month; i++) {
number += table[row][i];
}
number += day;
number %= 7;
printf("%s\n", WeekTable[number]);
}
return 0;
}