Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func zeller(month, day int) int {
	year := 2004
	if month == 1 || month == 2 {
		year--
		month += 12
	}
	return (year + year/4 - year/100 + year/400 + (13*month+8)/5 + day)%7
}

func main() {
	scanner.Split(bufio.ScanWords)
	for {
		month := nextInt()
		day := nextInt()
		if month == 0 && day == 0{
			break
		}
		switch zeller(month, day) {
		case 0:
			fmt.Println("Sunday")
		case 1:
			fmt.Println("Monday")
		case 2:
			fmt.Println("Tuesday")
		case 3:
			fmt.Println("Wednesday")
		case 4:
			fmt.Println("Thursday")
		case 5:
			fmt.Println("Friday")
		case 6:
			fmt.Println("Saturday")
		}
	}
}

C++: #include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <string>
#include <queue>
#include <algorithm>
#include <cctype>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const double pi=acos(-1);

int x,y,tu[11]={31,29,31,30,31,30,31,31,30,31,30};

int main(){
	while(1){
		cin>>x>>y;
		if(!x&&!y) break;
		int num=0;
		for(int i=0;i<x-1;i++) num+=tu[i];
		num+=y;
		int ans=num%7;
		if(ans==1) cout<<"Thursday"<<endl;
		else if(ans==2) cout<<"Friday"<<endl;
		else if(ans==3) cout<<"Saturday"<<endl;
		else if(ans==4) cout<<"Sunday"<<endl;
		else if(ans==5) cout<<"Monday"<<endl;
		else if(ans==6) cout<<"Tuseday"<<endl;
		else if(!ans) cout<<"Wednsday"<<endl;
	}
}

C++: #include<stdio.h>
#include<windows.h>

void y(int x ){
	if(x == 0)
		puts("Thursday");
	else if(x == 1)
		puts("Friday");
	else if(x == 2)
		puts("Saturday");
	else if(x == 3)
		puts("Sunday");
	else if(x == 4)
		puts("Monday");
	else if(x == 5)
		puts("Tuesday");
	else if(x == 6)
		puts("Wednesday");
}

int main(void){
	int M,D;
	while(1){
		int date = 0,ans;
		int m[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
		
		scanf("%d%d", &M, &D);
		if(M == 0 && D  == 0)break;
		for(int i = 1; i <= 12 ; i++){
			for(int j = 1; j <= m[i-1]; j++){
				if(i == M && j == D){
					ans = date;
				}
				printf("%d%dú%d\n",i,j,date%7);
	//			y(date%7);
				date++;
			}
			Sleep(1000);
		}
		y(ans%7);
	}
	
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(void)
{
  int m, d;
  
  while(1) {
    cin >> m >> d;
    if(m == 0) break;
    
    for(int i = m ; i > 1 ; i--) {
      if(i-1 == 4 || i-1 == 6 || i-1 == 9 || i-1 == 11) d += 30;
      else if(i-1 == 2) d += 29;
      else if(i-1 == 1 || i-1 == 3 || i-1 == 5 || i-1 == 7 || i-1 == 8 || i-1 == 10) d += 31;
    }
    
    if(d % 7 == 1) cout << "Thursday" << endl;
    if(d % 7 == 2) cout << "Friday" << endl;
    if(d % 7 == 3) cout << "Saturday" << endl;
    if(d % 7 == 4) cout << "Sunday" << endl;
    if(d % 7 == 5) cout << "Monday" << endl;
    if(d % 7 == 6) cout << "Tuesday" << endl;
    if(d % 7 == 7) cout << "Wednesday" << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(){
  for (;;) {
    int m, d;
    cin >> m >> d;
    if (m == 0) break;

    vector<int> day = {31, 29, 31, 30, 31, 30, 31, 30, 31, 30, 30, 31};
    int tmp = d;
    for (int i = 0; i < m - 1; i++) {
      tmp += day.at(i);
    }

    int ans = tmp % 7;
    vector<string> week = {"Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday"};
    cout << week.at(ans) << endl;
  }
}

C++: #include <iostream>
#include <vector>
#include <string>

using namespace std;

int main(int argc, char *argv[]) {
  vector<string> result;
  int m, d;
  int mday[12] = {31, 29, 31, 30, 31, 30,
                  31, 31, 30, 31, 30, 31};

  while (true) {
    cin >> m >> d;
    if (m == 0 && d == 0)
      break;
    int days = 0;
    for (int i = 1; i < m; i++)
      days += mday[i-1];
    days += d;
    days %= 7;
    if (days == 1)
      result.push_back("Thursday");
    else if (days == 2)
      result.push_back("Friday");
    else if (days == 3)
      result.push_back("Saturday");
    else if (days == 4)
      result.push_back("Sunday");
    else if (days == 5)
      result.push_back("Monday");
    else if (days == 6)
      result.push_back("Tuesday");
    else
      result.push_back("Wednesday");
  }

  for (int i = 0; i < result.size(); i++)
    cout << result[i] << endl;
  return 0;
}

C++: #include <iostream>

using namespace std;


int totalDate(int month, int date)
{
	static const int MONTH[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

	int sum = 0;
	for(int i = 0; i < month-1; i++)
		sum += MONTH[i];

	return sum + date;
}

const char* day(int total_date)
{
	static const char* DAY[] = {"Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"};

	return DAY[(total_date-1)%7];
}

int main()
{
	while(true)
	{
		int month, date;
		cin >> month >> date;

		if(month == 0)
			break;

		cout << day(totalDate(month, date)) << endl;
	}

	return 0;
}

C++: #include<iostream>
using namespace std;
#include<cstdio>
int main(){
  int year[12]={31,29,31,30,31,30,31,31,30,31,30,31};
  int month,day,ans;
  while(1){
    cin>>month>>day;
    if(!month && !day)break;
    ans=0;
    for(int i=1;i<month;i++){
      ans+=year[i-1];
    }
    ans+=day;
    switch (ans%7){
    case 1: cout<<"Thursday"<<endl;
	break;
    case 2: cout<<"Friday"<<endl;
	break;
    case 3: cout<<"Saturday"<<endl;
	break;
    case 4: cout<<"Sunday"<<endl;
	break;
    case 5: cout<<"Monday"<<endl;
	break;
    case 6: cout<<"Tuesday"<<endl;
	break;
    case 0: cout<<"Wednesday"<<endl;
	break;
    }
  }
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
using namespace std;

#define FOR(i,a,b) for(long long int i=(a);i<(b);i++)
#define REP(i,n) for(long long int i=0;i<(n);i++)
#define ALL(s) (s).begin(),(s).end()

#define PI 3.14159265358479

typedef long long ll;
typedef vector<long long int> vi;
typedef vector<long long int>::iterator vit;

int main(){
	int m, d, c = 0;
	bool f = 0;
	int a[13] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
	while (cin >> m >> d){
		if (m == 0)break;
		for (int i = 0; i < m; i++){
			for (int j = 0; j < a[i]; j++){
				c++;
				if (i == m - 1 && j == d - 1){
					f = 1;
					break;
				}
			}
			if (f)break;
		}
		c = c % 7;
		if (c == 1){
			cout << "Thursday\n";
		}
		else if (c == 2){
			cout << "Friday\n";
		}
		else if (c == 3){
			cout << "Saturday\n";
		}
		else if (c == 4){
			cout << "Sunday\n";
		}
		else if (c == 5){
			cout << "Monday\n";
		}
		else if (c == 6){
			cout << "Tuesday\n";
		}
		else {
			cout << "Wednesday\n";
		}
		c = 0;
		f = 0;
	}
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define EPS (1e-10)
using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

const int days[12] = {
  31,29,31,30,
  31,30,31,31,
  30,31,30,31
};

const char *date[7] = {
  "Monday",
  "Tuesday",
  "Wednesday",
  "Thursday",
  "Friday",
  "Saturday",
  "Sunday"
};

int ans[12][31];

int main(){
  int d = 3;
  REP(i,12){
    REP(j,days[i]){
      ans[i][j] = (d++)%7;
    }
  }
  int a,b;
  while(cin>>a>>b,a)
    cout << date[ans[a-1][b-1]] << endl;

  return 0;
}