Go: package main

import "fmt"

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

	for {
		var m, d int
		fmt.Scan(&m, &d)
		if m == 0 {
			break
		}

		for i := 0; i < m-1; i++ {
			d += days[i]
		}

		fmt.Println(weekday[d%7])
	}
}

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 || i!=12) {
					add += 2;
				}
				else {
					add += 3;
				}
			}
		}
		today += add;
		day = today%7;
		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<stdio.h>
int main(){
	int i,a,b;
	int c[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	int count=0,judge;
	while(1){
		scanf("%d",&a);
		scanf("%d",&b);
		if(a==0&&b==0)
			return 0;
		for(i=0;i<a-1;i++)
			count=count+c[i];
		count= count+b;
		judge=count%7;
		switch(judge){
			case 0:
				printf("Wednesday\n");
				break;
			case 1:
				printf("Thursday\n");
				break;
			case 2:
				printf("Friday\n");
				break;
			case 3:
				printf("Saturday\n");
				break;
			case 4:
				printf("Sunday\n");
				break;
			case 5:
				printf("Monday\n");
				break;
			case 6:
				printf("Tuesday\n");
				break;
		}
	}
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <functional>
#include <cstring>
#include <queue>
#include <math.h>
#include <iterator>
using namespace std;

int main() {
	int c[12] = { 31,29,31,30,31,30,31,31,30,31,30,31 };
	while (true) {
		int a, b,d = 0;
		scanf("%d%d", &a, &b);
		if (a == 0) goto end;
		d = b;
		for (int i = 0;i < a-1;++i) {
			d += c[i];
		}
		if (d%7 == 6) {
			printf("Tuesday\n");
		}
		else if (d % 7 == 0) {
			printf("Wednesday\n");
		}
		else if (d % 7 == 1) {
			printf("Thursday\n");
		}
		else if (d % 7 == 2) {
			printf("Friday\n");
		}
		else if (d % 7 == 3) {
			printf("Saturday\n");
		}
		else if (d % 7 == 4) {
			printf("Sunday\n");
		}
		else if (d % 7 == 5) {
			printf("Monday\n");
		}
	}
end:;
}

C++: //0027 What day is today?

//2004N11ú`1231úÜÅÌútðüÍµ½Æ«A»Ìjúð¦Ä­¾³¢
//È¨2004N11úÍØjúÅA2004NÍ[NÅ·

#include<iostream>
#include<numeric>
using namespace std;

int main(void)
{
	const char* week[] = 
	{
		"Monday",
		"Tuesday",
		"Wednesday",
		"Thursday",
		"Friday",
		"Saturday",
		"Sunday",
	};
	//indexÌú
	const int days[13] = 
	{
		0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
	};
	//indexÌ1úÌA11ú©çÌoßú
	int elapsedDays[13];
	partial_sum(days, days+13, elapsedDays);

	int month, day;
	
	while(cin >> month >> day, month)
	{
		cout << week[ (elapsedDays[month-1] + day + 2) %  7] << endl;
	}
	return 0;
}

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

int main() {
	int month, day;
	while(1) {
		cin >> month >> day;
		if(month == 0) break;
		else {
			int counter = 1;
			int numDay = 0;
			while(1) {
				if(month == counter) {
					numDay += day;
					break;
				}
				else {
					if(counter == 1 || counter == 3 || counter == 5 || counter == 7 || counter == 8 || counter == 10 || counter == 12) {
						numDay += 31;
						counter++;
					}
					else if(counter == 2){
						numDay += 29;
						counter++;
					}
					else {
						numDay += 30;
						counter++;
					}
				}
			}
			if(numDay % 7 == 1) cout << "Thursday" << endl;
			else if(numDay % 7 == 2) cout << "Friday" << endl;
			else if(numDay % 7 == 3) cout << "Saturday" << endl;
			else if(numDay % 7 == 4) cout << "Sunday" << endl;
			else if(numDay % 7 == 5) cout << "Monday" << endl;
			else if(numDay % 7 == 6) cout << "Tuesday" << endl;
			else cout << "Wednesday" << endl;
		}
	}
	return 0;
}

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

using namespace std;

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

int main(void) {
    int M, D;
    while(1) {
        int elapsed = 0;
        cin >> M >> D;

        if(M == 0 && D == 0) break;

        for(int i = 1; i < M; i++) elapsed += days[i];

        elapsed += D;

        int t = elapsed % 7;

        if(t == 1) {
            cout << "Thursday" << endl;
        } else if(t == 2) {
            cout << "Friday" << endl;
        } else if(t == 3) {
            cout << "Saturday" << endl;
        } else if(t == 4) {
            cout << "Sunday" << endl;
        } else if(t == 5) {
            cout << "Monday" << endl;
        } else if(t == 6) {
            cout << "Tuesday" << endl;
        } else {
            cout << "Wednesday" << endl;
        }
    }
    return 0;
}

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;
}