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 <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <stack>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
using namespace std;

int main(){
    int m, d;
    while (cin>>m>>d){
        if (m == 0) break;
        int dow = 3, num[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        vector<string> str;
        str.push_back("Monday");
        str.push_back("Tuesday");
        str.push_back("Wednesday");
        str.push_back("Thursday");
        str.push_back("Friday");
        str.push_back("Saturday");
        str.push_back("Sunday");

        int sum = 0;
        for (int i=0; i < m-1; i++)
            sum += num[i];
        sum += d+2;
        cout << str[sum%7] << endl;
    }
}

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

int main() {
	int a, b;
	string day[] = { "Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday" };
	int months[] = { 31,29,31,30,31,30,31,31,30,31,30,31 };
	while (cin >> a >> b, a) {
		a--; b--;
		rep(i, a)b += months[i];
		cout << day[b % 7] << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n,m;
  int x[12] = {0,3,4,0,2,5,0,3,6,1,4,6};
  while(cin >>n>>m,n||m){
    if((m+x[n-1])%7 == 1) cout <<"Thursday"<<endl;
    if((m+x[n-1])%7 == 2) cout <<"Friday"<<endl;
    if((m+x[n-1])%7 == 3) cout <<"Saturday"<<endl;
    if((m+x[n-1])%7 == 4) cout <<"Sunday"<<endl;
    if((m+x[n-1])%7 == 5) cout <<"Monday"<<endl;
    if((m+x[n-1])%7 == 6) cout <<"Tuesday"<<endl;
    if((m+x[n-1])%7 == 0) cout <<"Wednesday"<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;

int main()
{
	int month[]={0,31,29,31,30,31,30,31,31,30,31,30,31};
	int m,day,sumday;
    while(1){
		cin >> m; // 月
		if (m==0){ break;}
		cin >> day;  //日付
		for(int i=0;i<m;i++){
			day+=month[i];
		}
		switch(day%=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;
			default:
				cout<<"Wednesday"<<endl;
				break;
		}
		
	}
	return 0;
}

C++: #include <stdio.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

const char dat[7][16] = {
    "Monday", "Tuesday", "Wednesday", "Thursday",
    "Friday", "Saturday", "Sunday",
};
const int s[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

int main() {
    for (;;) {
        int m, d;
        scanf("%d%d", &m, &d);
        if (m == 0 && d == 0) return 0;
        m--, d--;
        rep (i, m) d += s[i];
        puts(dat[(d+3)%7]);
    }
}

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

using namespace std;

int main()
{ 
	const string day[7] = {  "Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday" };
	const int days[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

	int month, date;

	while (cin >> month >> date, month)
	{
		int sum = 0;
		for (int i = 1; i < month; ++i)
			sum += days[i - 1];

		sum += date;
		cout << day[sum % 7] << endl;
	}

	return 0;
}

C++: #include <iostream>
using namespace std;

int main(){
  int m,d;
  int cnt;
  string days[7]={"Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"};
  while(1){
    cnt = 0;
    cin >> m >> d;
    if(m == 0 && d == 0) break;
    cnt += d;
    for(m--;m>0;m--){
      switch (m){
      case 4:
      case 6:
      case 9:
      case 11:
	cnt += 30;
      case 2:
	cnt += 29;
      default:
	cnt += 31;
      }
    }
    cout << days[cnt%7-1] << endl;
  }
}

C++: // 2011/07/12 Tazoe

#include <iostream>
using namespace std;

int main()
{
	int days[12];
	days[0]  = 0;
	days[1]  = days[0] +31;
	days[2]  = days[1] +29;
	days[3]  = days[2] +31;
	days[4]  = days[3] +30;
	days[5]  = days[4] +31;
	days[6]  = days[5] +30;
	days[7]  = days[6] +31;
	days[8]  = days[7] +31;
	days[9]  = days[8] +30;
	days[10] = days[9] +31;
	days[11] = days[10]+30;

	while(true){
		int m, d;
		cin >> m >> d;
		if(m==0)
			break;

		switch((days[m-1]+d)%7){
			case 0:
				cout << "Wednesday" << endl;
				break;
			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;
		}
	}

	return 0;
}

C++: #include <iostream>
#include <cstring>
using namespace std;

int md[12] = {0,31,29,31,30,31,30,31,31,30,31,30};
char* day[7] = {"Mon","Tues","Wednes","Thurs","Fri","Satur","Sun"};

int main()
{
	int m,d;
	while(cin >> m >> d, m||d)
	{
		for(int i=0; i<m; i++)
		{
			d+=md[i];
		}
		cout << day[(d+2)%7] << "day" << endl;

	}
}

C++: #include <iostream>
#include <string>
using namespace std;

string week[] = {"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
int days[] = {31,29,31,30,31,30,31,31,30,31,30,31};

int main(){
    int month, day;
    while(cin >> month >> day, month+day){
        int n = 0;
        for(int i=1; i<month; i++){
            n += days[i-1];
        }
        n += day;
        n %= 7;
        cout << week[n] <<endl;
    }
    return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;

int main() {
	string str[50];
	int f;
	for (int i = 0;; i++) {
		int a, b;
		cin >> a >> b;
		if (a == 0 && b == 0) {			
			f = i;
			break;
		}
		{
			if (a == 2) {
				b += 31;
			}
			if (a == 3) {
				b += 60;
			}
			if (a == 4) {
				b += 91;
			}
			if (a == 5) {
				b += 121;
			}
			if (a == 6) {
				b += 152;
			}
			if (a == 7) {
				b += 182;
			}
			if (a == 8) {
				b += 213;
			}
			if (a == 9) {
				b += 244;
			}
			if (a == 10) {
				b += 274;
			}
			if (a == 11) {
				b += 305;
			}
			if (a == 12) {
				b += 335;
			}
		}
		//?????\????±????(52???73)
		{
			if ((b & 7) == 0) {
				str[i] = "Wednesday";
			}
			if ((b & 7) == 1) {
				str[i] = "Thursday";
			}
			if ((b & 7) == 2) {
				str[i] = "Friday";
			}
			if ((b & 7) == 3) {
				str[i] = "Saturday";
			}
			if ((b & 7) == 4) {
				str[i] = "Sunday";
			}
			if ((b & 7) == 5) {
				str[i] = "Monday";
			}
			if ((b & 7) == 6) {
				str[i] = "Tuesday";
			}
		}
	}

	for (int i = 0; i < f; i++){
		cout << str[i] << endl;
	}

	char c;
	cin >> c;

	return 0;
}