/究极复杂解法/
include [HTML_REMOVED]
include [HTML_REMOVED]
using namespace std;
bool yea(int year)
{
if(year%4 ==0 && year%100 != 0)
return true;
if(year%400 == 0)
return true;
return false;
}
int m[15] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
int main()
{
long long day , year , i , t , j;
string month;
while(cin>>day>>month>>year)
{
t = -1;
for(i=1;i<year;i++)
{
if(yea(i))
{
t += 366;
}
else
{
t += 365;
}
}
if("January" == month)
j = 1;
else if("February" == month)
j = 2;
else if("March" == month)
j = 3;
else if("April" == month)
j = 4;
else if("May" == month)
j = 5;
else if("June" == month)
j = 6;
else if("July" == month)
j = 7;
else if("August" == month)
j = 8;
else if("September" == month)
j = 9;
else if("October" == month)
j = 10;
else if("November" == month)
j = 11;
else if("December" == month)
j = 12;
for(i=1;i<j;i++)
{
if(yea(year) && i == 2)
{
t += 29;
}
else
t += m[i];
}
t +=day;
t%=7;
switch(t)
{
case 0:
cout<<"Monday"<<endl;
break;
case 1:
cout<<"Tuesday"<<endl;
break;
case 2:
cout<<"Wednesday"<<endl;
break;
case 3:
cout<<"Thursday"<<endl;
break;
case 4:
cout<<"Friday"<<endl;
break;
case 5:
cout<<"Saturday"<<endl;
break;
case 6:
cout<<"Sunday"<<endl;
break;
}
}
return 0;
}