#include <iostream>
#include <cstring>
#include <algorithm>
#include <unordered_map>
using namespace std;
int months[13] = {
0, 31, 28, 31, 30, 31, 30, 31, 31,
30, 31, 30, 31
};
unordered_map<string, int> month_name = {
{"January", 1},
{"February", 2},
{"March", 3},
{"April", 4},
{"May", 5},
{"June", 6},
{"July", 7},
{"August", 8},
{"September", 9},
{"October", 10},
{"November", 11},
{"December", 12},
};
string week_name[7] = {
"Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday",
"Sunday"
};
int is_leap(int year)
{
return year % 4 == 0 && year % 100 || year % 400 == 0;
}
int get_days(int year, int month)
{
int s = months[month];
if (month == 2) return s + is_leap(year);
return s;
}
int main()
{
int d, m, y;
string str;
while (cin >> d >> str >> y)
{
m = month_name[str];
int i = 1, j = 1, k = 1;
int days = 0;
while (i < y || j < m || k < d)
{
k ++, days ++ ;
if (k > get_days(i, j))
{
k = 1;
j ++ ;
if (j > 12)
{
j = 1;
i ++ ;
}
}
}
cout << week_name[days % 7] << endl;
}
return 0;
}