#include <iostream> using namespace std; string week[8] = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}; string month[13] ={"January", "February", "March", "April", "May", "June","July", "August", "September", "October", "November", "December"}; 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} }; int IsRunNian(int year) { return ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) ; } int main() { int day,year; string m; int mon = 0; while(cin>>day>>m>>year){ for(int i=0;i<13;i++){ if(m == month[i]){ mon = i+1; break; } } int num = 0; for(int i=1;i<year;i++){ if(IsRunNian(i)){ num+=366; }else{ num+=365; } } for(int i=0;i<mon;i++){ int a = IsRunNian(year); num += daytab[a][i]; } num += (day - 1); string weekday = week[num % 7]; cout<<weekday<<endl; } }