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++: #define _USE_MATH_DEFINES
 
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>

using namespace std;

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

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

		int ad = 0;
		for(int i=1;i<m;i++){
			ad+=hi[i-1];
		}
		cout << youbi[(ad+d-1)%7] << endl;
	}
	return 0;
}

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

string day[] = { "Thursday" , "Friday" , "Saturday" , "Sunday" , "Monday" , "Tuesday" , "Wednesday" } ;
int month[] = { 31,29,31,30,31,30,31,31,30,31,30,31 } ;
string calendar[13][32] = {} ;

int main(){
	
	int x , y , n=0 ;
	
	for( int i=0 ; i<12 ; i++ ){
		for( int j=0 ; j<=month[i] ; j++ ){
			calendar[i][j] = day[n%7] ;
			n++ ;
		}
		n-- ;
	}
	
	while(1){
		cin >> y >> x ;
		if( y==0 && x==0 ) break ;
		
		cout << calendar[y-1][x-1] << endl ;
	}
	
return 0 ;
}

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

int main()
{
	int a, b, count = 0;
	int ans[100];
	while (cin >> a >> b) {
		if (a == 0 && b == 0)
			break;
		if (a == 1 || a == 4 || a == 7) {
			ans[count] = (b % 7 + 3)%7;
		}
		else if (a == 9 || a == 12) {
			ans[count] = (b % 7 + 2)%7;
		}
		else if (a == 2 || a == 8) {
			ans[count] = (b % 7 + 6)%7;
		}
		else if (a == 3 || a == 11) {
			ans[count] = b % 7;
		}
		else if (a == 5) {
			ans[count] = (b % 7 + 5)%7;
		}
		else if (a == 6) {
			ans[count] = (b % 7 + 1)%7;
		}
		else if (a == 10) {
			ans[count] = (b % 7 + 4)%7;
		}
		count++;
	}
	for (int i = 0; i < count; i++) {
		if (ans[i] == 1)
			cout << "Monday" << endl;
		else if (ans[i] == 2)
			cout << "Tuesday" << endl;
		else if (ans[i] == 3)
			cout << "Wednesday" << endl;
		else if (ans[i] == 4)
			cout << "Thursday" << endl;
		else if (ans[i] == 5)
			cout << "Friday" << endl;
		else if (ans[i] == 6)
			cout << "Saturday" << endl;
		else if (ans[i] == 7)
			cout << "Sunday" << endl;
	}
}

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

using namespace std;

int main(void) {

	/*
	double x[3] = { 0,0,0 };
	double y[3] = { 0,0,0 };
	double xp = 0, yp = 0;
	int flag[3] = { 0,0,0 };

	while (cin >> x[0]>> y[0]>> x[1]>> y[1]>> x[2]>> y[2]>> xp>> yp) {
		for (int i = 0; i < 3; i++) {
			int temp1 = (i + 1) % 3;
			int temp2 = (i + 2) % 3;
			double checkI = (y[temp1] - y[i]) * (x[temp2] - x[i]) - (x[temp1] - x[i]) * (y[temp2] - y[i]);
			double checkP = (y[temp1] - y[i]) * (xp - x[i]) - (x[temp1] - x[i]) * (yp - y[i]);

			if (checkI * checkP > 0) {
				flag[i] = 1;
			}
		}
		if (flag[0] == 1 && flag[1] == 1 && flag[2] == 1) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
		flag[0] = 0;
		flag[1] = 0;
		flag[2] = 0;
	}
	*/
	/*
	int input_num;
	vector<int> train_num;
	while (cin >> input_num) {
		if (input_num == 0) {
			cout << train_num.back() << endl;
			train_num.pop_back();
		}
		else if (input_num >= 1 && input_num <= 10) {
			train_num.push_back(input_num);
		}
	}
	*/
	/*
	int d;
	int sum = 0;
	while (cin >> d) {
		for (int i = 0; i < 600 / d; i++) {
			sum += d*i*d*i*d;
		}
		cout << sum << endl;
		sum = 0;
	}
	*/
	/*
	int a[4], b[4];

	while (cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]) {
		int hit = 0;
		int blow = 0;
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 4; j++) {
				if (a[i] == b[j]) {
					if (i == j) {
						hit++;
					}
					else {
						blow++;
					}
				}
			}
		}
		cout << hit << " " << blow << endl;
	}
	*/

	int Month[13]{
		0,
		31,29,31,30,
		31,30,31,31,
		30,31,30,31
	};
	//??????0?????\???6
	int dow = 2;
	int in_day, in_month;
	while (cin >> in_month >> in_day) {

		if (in_month == 0)break;

		dow = 2;
		for (int i = 0; i < in_month; i++) {
			dow += Month[i];
		}
		dow += in_day;
		if (dow % 7 == 0) {
			cout << "Monday" << endl;
		}
		else if (dow % 7 == 1) {
			cout << "Tuesday" << endl;
		}
		else if (dow % 7 == 2) {
			cout << "Wednesday" << endl;
		}
		else if (dow % 7 == 3) {
			cout << "Thursday" << endl;
		}
		else if (dow % 7 == 4) {
			cout << "Friday" << endl;
		}
		else if (dow % 7 == 5) {
			cout << "Saturday" << endl;
		}
		else if (dow % 7 == 6) {
			cout << "Sunday" << endl;
		}
	}
	return 0;
}

C++: #include <iostream>
	#include <cstdio>
	#include <cstdlib>
	#include <time.h>
	#include <math.h>
	#include <vector>
	#include <queue>
	#include <map>
	#include <set>
	#include <algorithm>
	#include <iterator>
	#include <sstream>
	#include <string>
	#include <bitset>
	using namespace std;
	#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
	#define rep(i, n) FOR(i, 0, n)
	#define FIN(V) cout<<V<<endl
	#define pb push_back
	#define INF (1 << 30)
	typedef pair<int, int> P;
	typedef long long ll;
	typedef priority_queue<int> pq;
	int StrToInt(string);
	string IntToStr(int);
	int dx[4] = {1, -1, 0, 0};
	int dy[4] = {0, 0, 1, -1};
	
	int main(void){
		int month[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
		int n, m;
		while(cin >> n >> m, n || m){
			int day = 0;
			rep(i, n-1)day += month[i];
			day += m;
			cout << day << endl;
			int yo = day % 7;
			if(yo == 1){
				FIN("Thursday");
			}else if(yo == 2){
				FIN("Friday");
			}else if(yo == 3){
				FIN("Saturday");
			}else if(yo == 4){
				FIN("Sunday");
			}else if(yo == 5){
				FIN("Monday");
			}else if(yo == 6){
				FIN("Tuesady");
			}else if(yo == 0){
				FIN("Wednesday");
			}
		}


		return 0;
	}
	
	
	
	int StrToInt(string s){
		stringstream ss;
		ss << s;
		int val;
		ss >> val;
		return val;
	}
	string IntToStr(int i){
		stringstream ss;
		ss << i;
		return ss.str();
	}

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

int main()
{
    string day[]={"Wednesday","Thirsday","Friday","Saturday","Sunday","Monday","Tuesday"};
    int Mon[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
    int m,d;
    while(cin>>m>>d,m*d){
        int allDay=d;
        for(;m>0;m--){
            allDay += Mon[m-1];
        }
        cout<<day[allDay%7]<<endl;
    }
}

C++: #include <iostream>

int day_count(int month, int day) {
    int per_month[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};    
    int total = 0;
    for (int i = 0; i < month - 1; i++) {
        total += per_month[i];
    }
    return total + day;
}

void day_check(int month, int day) {
    int count = day_count(month, day);
    count %= 7;
    std::string day_array[] = {"Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday"};
    std::cout << day_array[count] << std::endl;
    return; 
}

int main(void) {
    int month;
    int day;
    while (1) {
        std::cin >> month >> day;
        if (month == 0) {
            return 0;;
        }
        day_check(month, day);
    }
    return 0;
}