#include <cmath>
#include <iostream>
#include <cstdio>
#include <string>

using namespace std;
const int base_year = 2000;
const int base_month = 1;
const int base_day = 1;
const int base_week = 6;


int StringToInt(string str) {
    int month = 0;
    if (str == "January") {
        month = 1;
    } else if (str == "February") {
        month = 2;
    } else if (str == "March") {
        month = 3;
    } else if (str == "April") {
        month = 4;
    } else if (str == "May") {
        month = 5;
    } else if (str == "June") {
        month = 6;
    } else if (str == "July") {
        month = 7;
    } else if (str == "August") {
        month = 8;
    } else if (str == "September") {
        month = 9;
    } else if (str == "October") {
        month = 10;
    } else if (str == "November") {
        month = 11;
    } else if (str == "December") {
        month = 12;
    }
    return month;
}

bool isLeap(int year) {
    if (year % 400 == 0 || year % 4 == 0 && year % 100 != 0) {
        return true;
    } else {
        return false;
    }
}

//2000-1-1 Saturday
int main() {
    int day, year;
    string M;
    while (cin>>day>>M>>year) {
        int monDays[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        int month = StringToInt(M);
        int difference = 0; //和基准相差的天数
        if (year >= base_year) {
            for (int i = base_year; i < year; i++) {
                if (isLeap(i)) {
                    difference += 366;
                } else {
                    difference += 365;
                }
            }
            if (isLeap(year)) {
                monDays[2] = 29;
            } else {
                monDays[2] = 28;
            }
            for (int i = base_month; i < month; i++) {
                difference += monDays[i];
            }
            difference = difference + day - base_day;
        } else {
            for (int i = year; i < base_year; i++) {
                if (isLeap(i)) {
                    difference -= 366;
                } else {
                    difference -= 365;
                }
            }
            if (isLeap(year)) {
                monDays[2] = 29;
            }
            for (int j = base_month; j < month; j++) {
                difference += monDays[j];
            }
            difference = difference + day - base_day;
        }
        int a = (difference % 7 + base_week) % 7;
        string week = "";
        if (a == 1) {
            week = "Monday";
        } else if (a == 2) {
            week = "Tuesday";
        } else if (a == 3) {
            week = "Wednesday";
        } else if (a == 4) {
            week = "Thursday";
        } else if (a == 5) {
            week = "Friday";
        } else if (a == 6) {
            week = "Saturday";
        } else {
            week = "Sunday";
        }
        cout << week << endl;
    }
    return 0;
}

while (cin>>day>>M>>year)这样输入三个值