#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n;i>=0;i--)
#define INF 100000005
#define MAX 100001
#define mp make_pair
#define pb push_back
#define fi first
#define se second
using namespace std;
//__gcd(a,b), __builtin_popcount(a);

bool b[501];
int main(){
	int n, m, t1,t2;
	while(1){
		stack<int> s[501];
		scanf("%d%d", &n, &m);
		if(!n)break;
		fill(b, b+501, false);
		rep(i,m){
			scanf("%d%d", &t1, &t2);
			s[t1].push(t2);
			s[t2].push(t1);
		}
		while(!s[1].empty()){
			t1 = s[1].top();s[1].pop();
			b[t1] = 1;
			while(!s[t1].empty()){
				t2 = s[t1].top();s[t1].pop();
				b[t2] = true;
			}
		}
		int ans = 0;
		rrep(i,n)if(b[i]&&i!=1)ans++;
		printf("%d\n", ans);
	}
	return 0;
}
#include <iostream>
#include <string>
using namespace std;
int countup_days(int m, int d) // m月d日が、1月1日から何日目か返す
{
    int         sum     = 0;
    const int   month[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,};
    for (int i=1; i<m; i++) {
        sum += month[i];
    }
    return sum + d -1;
}
string what_day(int days) // 1/1からdays日後は何曜日か文字列を返す
{
    string day[]   = {"Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"};
    return day[days%7];
}
int main()
{
    int m, d;
    while (true) {
        cin >> m >> d;
        if (m==0 && d==0)
            break;
        cout << what_day(countup_days(m, d)) << endl;
    }
}