#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;

int main() {
    int x,y;
    scanf("%d%d",&x,&y);
    ll ans = 0;
    if(x == 3) ans += 100000;
    else if(x == 2) ans += 200000;
    else if(x == 1) ans += 300000;
    if(y == 3) ans += 100000;
    else if(y == 2) ans += 200000;
    else if(y == 1) ans += 300000;
    if(x == 1 && y == 1) ans += 400000;
    printf("%ld\n",ans);
}
#include <iostream>
#include <string>

using namespace std;

int main() {
    int m, d, past;
    int day[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
    string week[] = { "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday" };
    while (cin >> m >> d, m != 0) {
        past = 0;
        for (int i = 0; i < m - 1; i++) {
            past += day[i];
        }
        past += d - 1;
        cout << week[past % 7] << endl;
    }

    return 0;
}