include<stdio.h>
include<stdbool.h>
include <string.h>
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}
};
char month[12][14]=
{
"January","February","March","April","May","June","July","August","September","October","November","December"
};
char week[7][14]=
{
"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"
};
bool isLeapYear(int year)
{
return (year%4 == 0&&year%100!=0)||(year%400 == 0);
}
int main()
{
int year,mon,day,m,sum;
char M[14];
while (scanf("%02d %s %04d", &day, M, &year) != EOF)
{
for(int i=0;i<12;i++)
{
if(strcmp(M, month[i])==0)
{
m=i;
break;
}
}
int number = 0;
for (int k = 1; k < year; k++)
{
if (isLeapYear(k))
{
number += 366;
}
else
{
number += 365;
}
}
int row = isLeapYear(year);
for (int j = 0; j <=m; j++)
{
number += daytab[row][j];
}
number+= day;
sum=number%7;
printf("%s\n", week[sum]);
return 0;
}
}