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 <bits/stdc++.h>
using namespace std;
int main(){
  long long a,b,cnt,mon[12]={0,31,29,31,30,31,30,31,31,30,31,30};
  string day[7]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
  while(cin >> a >> b){
    if(a==0 and b==0){
      break;
    }
    cnt=b;
    for(int i=0;i<a;i++){
      cnt+=mon[i];
    }
    cout << day[cnt%7] << endl;
  }
  return 0;
}

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

C++: //#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <math.h>
#include<algorithm>
#include <utility>
using namespace std;
int main() {//Thursda,Friday...0,1,2,3,4,5,6
	int month,day, today;//31%7=3
	int add=0;
	while (1) {
		cin >> month >> today;
		if (month == 0) {
			break;
		}
		if (month == 1) {
			add = 0;
		}
		else {
			for (int i = 1; i < month; i++) {
				if (i == 2) {
					add+=1;
				}
				else if (i % 2 == 0 && i < 8 || i == 11) {
					add += 2;
				}
				else {
					add += 3;
				}
			}
		}
		today += add;
		day = today%7;
		cout << add << endl;
		switch (day) {
		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;
		}
		add = 0;
	}
	return 0;
}

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

int main(){
	
	int m,d;
	string week[7]={
		"Sunday",
		"Monday",
		"Tuesday",
		"Wednesday",
		"Thursday",
		"Friday",
		"Saturday"
	};
	int month[13]={
		-1,3,6,0,3,5,1,3,6,2,4,0,2
	};
	while(cin>>m>>d,m){
		cout<<week[(month[m]+d)%7]<<endl;
	}
	
	return 0;
}

C++: #include <stdio.h>

int main()
{
	char week[7][10]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
	int month,day;
	int numday[12] = { 31,29,31,30,31,30,31,31,30,31,30,31 };
	int i;

	while((scanf("%d%d", &month, &day)) != EOF)
	{
		if (month == 0) break;
		for (i = 0; i < month -1; i++)
		{
			day += numday[i];
		}
		day = (day + 2)%7 ;
		printf("%s\n", week[day]);
	}
	return 0;
}

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

int main()
{
	const char* StartOfYear = "Thursday";

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

	int NumYoubi = -1;

	for(size_t i=0; i<7; ++i)
	{
		if(Youbi[i]==StartOfYear)
		{
			NumYoubi = i;
		}
	}

	if(NumYoubi==-1)
	{
		std::cout << "Youbi set error!\n";

		exit(1);
	}

	const int dayMaxSum[13] = 
	{
		0,
		31,
		60,
		91,
		121,
		152,
		182,
		213,
		244,
		274,
		305,
		335,
		366
	};

	int month=1,day=0,daySum=0;//month=0で終了するため1で初期化

	while(std::cin >> month >> day && month!=0)
	{
		daySum = dayMaxSum[month-1]+day;

		std::cout << Youbi[(daySum-1+NumYoubi)%7];//daySum-1で周期があう 1/1…7で割ったあまりが0 NumYoubiで位相ズレ（1/1の曜日）を表す

		std::cout << '\n';

		daySum=0;
	}
}

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

int m;
int d;
string days[] = {"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};

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

int main() {
  while (1) {
    scanf("%d%d", &m, &d);
    if (m == 0 && d == 0) return 0;

    int tot = d-1;
    for (int i=1; i<m; i++) {
      tot += GetNumDay(i);
    }

    puts(days[(3+tot)%7].c_str());
  }
}

C++: #include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
#include<map>
using namespace std;

int main(){
    int mod=1000000007;
    int m,d;
    int p[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
    map<int, string> week;
    week[0]="Monday";
    week[1]="Tuesday";
    week[2]="Wednesday";
    week[3]="Thursday";
    week[4]="Friday";
    week[5]="Suturday";
    week[6]="Sunday";
    for (;;){
        scanf("%d %d",&m,&d);
        if (d==0) break;
        int tmp=3;
        if (m>1) {
            for (int i=1;i<m;i++) {
                tmp=(tmp+p[i])%7;
            }
        }
        cout<<week[(tmp+d-1)%7]<<endl;
    }
    return 0;
}

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

int monthes[]={0,31,29,31,30,31,30,31,31,30,31,30,31};

std::string day[]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};

int main(void){
    int m,d,n;
    while(std::cin>>m>>d){
        if(m==0&&d==0) break;
        n=0;
        int i;
        for(i=1;i<m;i++) n+=monthes[i];
        n+=d
        std::cout<<day[n%7]<<std::endl;
    }
    return 0;
}

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

int main(){
	char* date[] = {"Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday"};
	int months[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	int m,d;
	while( cin >> m >> d, m ){
		int day=0;
		for( int i=0; i<m-1; i++ ){
			day += months[i];
		}
		day += d;
		cout << date[day%7] << endl;
	}
	return 0;
}

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

#define YEAR 2004

using namespace std;

int main() {
	vector<string> week;
	week.push_back("Sunday");
	week.push_back("Monday");
	week.push_back("Tuesday");
	week.push_back("Wednesday");
	week.push_back("Thursday");
	week.push_back("Friday");
	week.push_back("Saturday");
	int m,d,w;
	while(cin>>m>>d){
		w = (YEAR + YEAR/4 - YEAR/100 + YEAR/400 + (13*m+8)/5 + d) % 7;
		cout<<week.at(w)<<endl;
	}
	return 0;
}

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

using namespace std;


char str[7][10] = {"Thursday", "Friday", "Saturday","Sunday", "Monday", "Tuesday", "Wednesday"};
int days[13] = {0, 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335}; 

int main() {
	int month, day;
	while (scanf("%d%d", &month, &day), month + day) {
		printf ("%s\n", str[(days[month] + day - 1) % 7]);
	}
	return 0;
}

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

int main(){
	int m, d, ans, month, i, total = 0;
	while(1){
		cin >> m >> d;
		if (m == 0) break;
		for(i = 1; i < m; i ++){
			if(i==1||i==3||i==5||i==7||i==8||i==10||i==12){
				total += 31;
			}
			else if(i == 2){
				total += 29;
			}
			else{
				total += 30;
			}
		}
		total += d;

		ans = total % 7;

		switch (ans){
		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 << "Tuseday" << endl;
			break;
		case 0:cout << "Wednesday" << endl;
			break;
		}
		
		ans = 0, total = 0;
	}

	return 0;
}