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>

using namespace std;

int main()
{ 
	const string day[7] = { "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday" };
	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) - 1] << endl;
	}

	return 0;
}

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

int main()
{
	std::vector<std::string> day_of_week{
		"Thursday",
		"Friday",
		"Suterday",
		"Sunday",
		"Monday",
		"Tuesday",
		"Wednesday"
	};

	std::vector<int> day_num_of_month{
		31,
		29,
		31,
		30,
		31,
		30,
		31,
		31,
		30,
		31,
		30,
		31
	};

	int month = 0;
	int day = 0;

	while (std::cin >> month >> day)
	{
		if (0 == month) { break; }

		int days_elapsed = 0;
		for (int m = 1; m < month; ++m)
		{
			days_elapsed += day_num_of_month[m - 1];
		}
		days_elapsed += day;

		std::cout << day_of_week[(days_elapsed - 1) % 7] << std::endl;
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
	int M, D, days;
	int daysOfMonth[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	string daysOfWeek[] = {"Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday"};
	while (1) {
		cin >> M >> D;
		if (M == 0 && D == 0)
			break;
		days = 0;
		for (int i = 0; i < M; i++)
			days += daysOfMonth[i];
		days += D;
		cout << daysOfWeek[days % 7] << endl;
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
 
typedef long long ll;
typedef pair<int, int> ii;

#define EPS 1e-8

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

int main(){
	
	int m, d;
	while(cin >> m >> d, m, d){
		ll cnt = 3;
		rep(i, m-1) cnt += days[i];
		cnt += (d-1);
		cout << yobi[cnt%7] << endl;
	}
	


	
	return 0;
}

C++: #include<iostream>

int day_of_month( int m )
{
	switch( m ){
	 	case 2:
			return 29;
			break;
		case 4:
		case 6:
		case 9:
		case 11:
			return 30;
			break;
		default:
			return 31;
			break;
	}
}

int main()
{
	int m,d;
	const char week[][20] = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };
	
	while( 1 ){
		std::cin >> m >> d;
		if( !m && !d ) break;
		
		int nm = 1, nd = 1, nw = 3;
		while( 1 ){
			if( nm == m && nd == d ) break;
			nd++;
			nw = ( nw + 1 ) % 7;
			
			if( nd > day_of_month( nm ) ){
			 	nd = 1;
				nm++;
			}
		}
		
		std::cout << week[nw] << std::endl;
	}

 	return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
 
int month[] = {31,29,31,30,31,30,31,31,30,31,30,31};
string date[] = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
 
int main(){
    int M, D;
    while( cin >> M >> D, M ){
        int d = 3;
        for(int i=0; i<M-1; i++ ){
            d += month[i];
        }
        d += D;
        d %= 7;
        cout << date[d] << endl;
    }
}

C++: #include<iostream>

using namespace std;

int main() {
	int mon, date;
	while (cin >> mon >> date) {
		if (mon == 0) {
			break;
		}
	int year = 2004, tmp;
		if (0 < mon && mon <= 2) {
			year -= 1;
			mon += 12;
		}
		tmp = year;
		tmp += int(year / 4);
		tmp -= int(year / 100);
		tmp += int(year / 400);
		tmp += int((mon * 13 + 8) / 5);
		tmp += date;
		tmp %= 7;
		if (tmp == 0) {
			cout << "Sunday" << endl;
		}
		if (tmp == 1) {
			cout << "Monday" << endl;
		}
		if (tmp == 2) {
			cout << "Tuesday" << endl;
		}
		if (tmp == 3) {
			cout << "Wednesday" << endl;
		}
		if (tmp == 4) {
			cout << "Thursday" << endl;
		}
		if (tmp == 5) {
			cout << "Friday" << endl;
		}
		if (tmp == 6) {
			cout << "Saturday" << endl;
		}




	}
}

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

using namespace std;

int main(){
	string y[7] = {"Wednesday", "Thrsday", "Frinday", "Saturday", "Sunday", "Monday", "Tuesday"};
	int mon[13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

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

		while(m != 0){
			d = d + mon[m-1];
			m--;
		}
		cout << y[d%7] << endl;
	}
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>

using namespace std;

typedef  long long int lint;

#define rep(i, n) for (lint i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define mp make_pair
#define IP pair<int,int>
#define enld endl

int main() {
	vector<lint>A;
	A = {0,31,29,31,30,31,30,31,31,30,31,30,31 };
	vector<lint>S(13);
	S[0] = A[0];
	for (lint i = 1; i < 13; i++) {
		S[i] = S[i - 1] + A[i];
	}
	vector<string>B;
	B = { "Monday","Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };

	lint M, D;
	while (cin >> M >> D,!(M==0&&D==0)) {
		lint ALL = S[M - 1] + D;
		//cout << ALL << enld;
		cout << B[(ALL+2) % 7] << endl;
	}
}

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

const string day[] = {"Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday"};
const int da[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

int main(void){
  int m, d;
  while(cin >> m >> d, m | d){
    while(1){
      m--;
      if(m > 0){
        d += da[m];
      }else{
        break;
      }
    }
    cout << day[d%7] << endl;
  }
  return 0;
}