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 <iostream>
using namespace std;

int zeller(int y, int m, int d)
{
	if (m <= 2) {
		y--;
		m += 12;
	}
	
	int h;
	int C = y / 100;
	int Y = y % 100;
	int R = 5 * C + (C / 4);
	
	h = d + (26 * ++m / 10) + Y + (Y / 4) + R;
	h %= 7;
	return (h);
}

int main()
{
	int y = 2004;
	int m, d;
	int h;
	
	while (1){
		
		cin >> m >> d;
		if (m == 0){
			break;
		}
		
		h = zeller(y, m, d);
		
		//cout << h << endl;
		switch (h){
		  case 0:
		    cout << "Saturday";
			break;
			
		  case 1:
		    cout << "Sunday";
			break;
			
		  case 2:
		    cout << "Monday";
			break;
			
		  case 3:
		    cout << "Tuesday";
			break;
			
		  case 4:
		    cout << "Wednesday";
			break;
			
		  case 5:
		    cout << "Thursday";
			break;
			
		 case 6:
		   cout << "Friday";
		   break;
		}
		cout << endl;
	}
	
	return (0);
}

C++: #include<iostream>
#include<string>
using namespace std;
int sum_of_days(int m, int d){
  int sum = 0;
  int mon[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,};
  for(int i = 0; i < m; i++) sum += mon[i];
  return sum + d - 1;
}
string what_day(int s){
  string day[] = {"Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"};
  return day[s % 7];
}
int main(){
  int m, d;
  while(cin >> m >> d, !(m==0 && d==0)){
    cout << what_day(sum_of_days(m, d)) << endl;
  }
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int a[20][50]={{0}};
    int i=4;
    int x,y;
    for(int k=1;k<=31;k++)
    {
        a[1][k]=i;
        i++;
        if(i==8)i=1;
    }
    for(int k=1;k<=29;k++)
    {
        a[2][k]=i;
        i++;
        if(i==8)i=1;
    }
    for(int k=1;k<=31;k++)
    {
        a[3][k]=i;
        i++;
        if(i==8)i=1;
    }
    for(int k=1;k<=30;k++)
    {
        a[4][k]=i;
        i++;
        if(i==8)i=1;
    }
    for(int k=1;k<=31;k++)
    {
        a[5][k]=i;
        i++;
        if(i==8)i=1;
    }
    for(int k=1;k<=30;k++)
    {
        a[6][k]=i;
        i++;
        if(i==8)i=1;
    }
    for(int k=1;k<=31;k++)
    {
        a[7][k]=i;
        i++;
        if(i==8)i=1;
    }
    for(int k=1;k<=31;k++)
    {
        a[8][k]=i;
        i++;
        if(i==8)i=1;
    }
    for(int k=1;k<=30;k++)
    {
        a[9][k]=i;
        i++;
        if(i==8)i=1;
    }
    for(int g=1;g<=31;g++)
    {
        a[10][g]=i;
        i++;
        if(i==8)i=1;
    }
    for(int k=1;k<=30;k++)
    {
        a[11][k]=i;
        i++;
        if(i==8)i=1;
    }
    for(int k=1;k<=31;k++)
    {
        a[12][k]=i;
        i++;
        if(i==8)i=1;
    }
    //for(int bb=1;bb<=12;bb++)
    //{
    //    for(int aa=1;aa<32;aa++)
    //   {
    //        printf("a[%d][%d]=%d\n",bb,aa,a[bb][aa]);
    //    }
    //}
    while(cin>>x>>y)
    {
        if(x==0)break;
        if(a[x][y]==1)cout<<"Monday"<<endl;
        if(a[x][y]==2)cout<<"Tuesday"<<endl;
        if(a[x][y]==3)cout<<"Wednesday"<<endl;
        if(a[x][y]==4)cout<<"Thursday"<<endl;
        if(a[x][y]==5)cout<<"Friday"<<endl;
        if(a[x][y]==6)cout<<"Saturday"<<endl;
        if(a[x][y]==7)cout<<"Sunday"<<endl;
    }
    return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
int days[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
string week[] = {"Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"};

void solve()
{
	int m, d;
	while(cin >> m >> d, m || d)
	{
		int sum = 0;
		for(int i = 1; i < m; ++i)
		{
			sum += days[i - 1];
		}
		sum += d - 1;
		cout << week[sum % 7] << endl;
	}
}

int main()
{
	solve();
	return(0);
}

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

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

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

int main()
{
	int m, d;
	while (cin >> m >> d, m)
	{
		int y = 2004;
		if (m < 3)
		{
			y--;
			m += 12;
		}

		int z = (y + y/4 - y/100 + y/400 + (13*m+8)/5 + d) % 7;
		cout << w[z] << endl;
	}
}

C++: /*AOJ 0027*/

#include<iostream>
using namespace std;

int main(){

	int day[12]={31,29,31,30,31,30,31,31,30,31,30,31};

	int sum = 0;

	int month=0,date = 0;

	while(cin>>month){
		cin>>date;

		if(month == 0){
			break;
		}
		sum = 0;

		for(int i=0;i<month;i++){
			if(month != i+1){
				sum+= day[i];
			}
		}
		sum += date;
		
		if(sum%7==1){
			cout<<"Thursday"<<endl;
		}
		else if(sum%7 == 2){
			cout<<"Friday"<<endl;
		}
		else if(sum%7 == 3){
			cout<<"Saturday"<<endl;
		}
		else if(sum%7 == 4){
			cout<<"Sunday"<<endl;
		}
		else if(sum%7 == 5){
			cout<<"Monday"<<endl;
		}
		else if(sum%7 == 6){
			cout<<"Tuesday"<<endl;
		}
		else{
			cout<<"Wednesday"<<endl;
		}
	}

	
	return 0;
}

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

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

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

int main() {
	int y, m, d, c, h;
	while (cin >> m >> d, m) {
		y = 2004 - (m <= 2);
		m = m + 12 * (m <= 2);
		c = y / 100;
		y %= 100;
		h = d + (26 * (m + 1)) / 10 + y + y / 4 + 5 * c + c / 4;
		cout << day[h % 7] << 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)
			break;
		if (a == 1 || a == 4 || a == 7) {
			ans[count] = (b % 7 + 3)%7;
			if (ans[count] % 7 == 0)
				ans[count] = +7;
		}
		else if (a == 9 || a == 12) {
			ans[count] = (b % 7 + 2)%7;
			if (ans[count] % 7 == 0)
				ans[count] = +7;
		}
		else if (a == 2 || a == 8) {
			ans[count] = (b % 7 + 6)%7;
			if (ans[count] % 7 == 0)
				ans[count] = +7;
		}
		else if (a == 3 || a == 11) {
			ans[count] = b % 7;
			if (ans[count] % 7 == 0)
				ans[count]=+7;
		}
		else if (a == 5) {
			ans[count] = (b % 7 + 5)%7;
			if (ans[count] % 7 == 0)
				ans[count] = +7;
		}
		else if (a == 6) {
			ans[count] = (b % 7 + 1)%7;
			if (ans[count] % 7 == 0)
				ans[count] = +7;
		}
		else if (a == 10) {
			ans[count] = (b % 7 + 4)%7;
			if (ans[count] % 7 == 0)
				ans[count] = +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;
	}
}