#include <cstdio>
#include "string"
#include "map"  // 引入map

using namespace std;    // c++ 标准

/*
输入:
9 October 2001
14 October 2001
输出:
Tuesday
Sunday
 */
int main () {
    char str[1000];
    int year, month, day, curr_year = 2023, curr_month = 2, curr_day = 8;
    string mon;
    map<string, int> months = {
        {"January", 1}, {"February", 2}, {"March", 3}, {"April", 4}, {"May", 5}, {"June", 6},
        {"July", 7}, {"August", 8}, {"September", 9}, {"October", 10}, {"November", 11}, {"December", 12}
    };

    map<int, string> weeks = {
        {0, "Sunday"}, {1, "Monday"}, {2, "Tuesday"}, {3, "Wednesday"},
        {4, "Thursday"}, {5, "Friday"}, {6, "Saturday"}
    };
    int days[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

    // 2023-02-08 三
    // 9 October 2001
    int start_year, start_month, start_day, target_year, target_month, target_day;
    bool is_before_day = false;
    while (EOF != scanf("%d %s %d", &day, str, &year)) {
        mon = str;    // c字符串 转换为 c++字符串
//        printf("%04d-%02d-%02d\n", year, months[mon], day); // 2001-10-09
        month = months[mon];

        // 从开始日期 往 目标日期推 数有多少天
        if (year < curr_year || curr_year == year && month < curr_month ||
                curr_year == year && curr_month == month && day < curr_day) {
            is_before_day = true;
        }

        if (is_before_day) {
            start_day = day;
            start_month = month;
            start_year = year;
            target_day = curr_day;
            target_month = curr_month;
            target_year = curr_year;
        } else {
            start_day = curr_day;
            start_month = curr_month;
            start_year = curr_year;
            target_day = day;
            target_month = month;
            target_year = year;
        }
        int total_days = 0;
        while (true) {
            if (start_year == target_year && start_month == target_month &&
                    start_day == target_day) {
                break;
            }
            start_year % 400 == 0 || start_year % 100 != 0 &&
            start_year % 4 == 0 ? days[2] = 29 : days[2] = 28;
            total_days++;

            start_day++;
            if (start_day > days[start_month]) {
                start_day = 1;
                start_month++;
                if (start_month > 12) {
                    start_month = 1;
                    start_year++;
                }
            }
        }
        if (is_before_day) {
            printf("%s\n", weeks[(10 - total_days % 7) % 7].c_str());
        } else {
            printf("%s\n", weeks[(total_days + 3) % 7].c_str());
        }
    }
}