#include <iostream>
#include <cstring>
using namespace std;

string months[12]{
    "January","February","March","April","May","June","July",\
        "August","September","October","November","December"
};

string weekdays[7]{
    "Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"
};

int isleap(int year){
    int leap=((year%4==0 && year%100!=0) || year%400==0);
    return leap;
}

int daytables[2][12]{
    {31,28,31,30,31,30,31,31,30,31,30,31},
    {31,29,31,30,31,30,31,31,30,31,30,31}
};


int year2days(int year){
    if(isleap(year))
        return 366;
    return 365;
}


int main(){
    int day;
    string monthname;
    int year;
    while(cin>>day && cin>>monthname && cin>>year){
        int month=0;
        for(;month<12;month++){
            if(monthname.compare(months[month])==0)
                break;
        }

        int days=0;
        if(year>2001){
            for(int i=2001;i<year;i++)
                days+=year2days(i);
            for(int j=0;j<month;j++)
                days+=daytables[isleap(year)][j];
        }
        else{
            for(int i=2001;i>year;i--)
                days-=year2days(i-1);
            for(int j=0;j<month;j++)
                days+=daytables[isleap(year)][j];
        }
        days+=day-1;
        int plus=days%7;
        cout<<weekdays[plus]<<endl;
    }
}