Go: package main

import (
        "fmt"
)

func main() {
        var weeks = []string{"Thursday",
                "Friday",
                "Saturday",
                "Sunday",
                "Monday",
                "Tuesday",
                "Wednesday"}

        for {
                var m, d int
                _, err := fmt.Scanf("%d %d", &m, &d)
                if err != nil || m + d == 0 {
                        break
                }
                var days int

                for {
                        lm, ld := getLastDay(m, d)
                        if lm + ld == 0 {
                                break
                        }
                        days++
                        m = lm
                        d = ld
                }
                fmt.Println(weeks[days%7])
        }
}

func getLastDay(m int, d int) (lm int, ld int) {
        if m == 1 && d == 1 {
                return 0, 0
        }

        if d > 1 {
                return m, d-1
        } else {
                if m == 3 {
                        return m-1, 29
                }
                if m == 3 || m == 5 || m == 7 || m == 10 || m == 12 {
                        return m-1, 30
                } else {
                        return m-1, 31
                }
        }
}

C++: #include<iostream>

using namespace std;

int main(void) {
	int m, d, day;
	string dstr[7] = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};

	while(true) {
		cin >> m >> d;
		if(m == 0) { break; }
		day = 0;
		switch(m) {
			case 12:
				day += 30;
			case 11:
				day += 31;
			case 10:
				day += 30;
			case 9:
				day += 31;
			case 8:
				day += 31;
			case 7:
				day += 30;
			case 6:
				day += 31;
			case 5:
				day += 30;
			case 4:
				day += 31;
			case 3:
				day += 29;
			case 2:
				day += 31;
			case 1:
				day += d;
				break;
		}
		cout << dstr[(day+9)%7] << endl;
	}

	return 0;
}

C++: #include <iostream>
using namespace std;
int main() {
  int mon, day;
  string youbi[7] = {"Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"};
  int tDay[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  int yb;

  while(cin >> mon >> day && mon) {
    yb = 0;
    for(int i = 0; i < mon-1; i++) {
      yb += tDay[i];
    }
    yb += day-1;
    yb %= 7;
    
    cout << youbi[yb] << endl;
  }
 
  return 0;
}

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

int m,d;
int data[] = {31,29,31,30,31,30,31,31,30,31,30,31};
string day[] = {"Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"};

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

		for(int i = 0; i < m - 1; i++){
			d+=data[m];
		}
		cout << day[(d-1)%7] << endl;
	}
}

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define INF 1000000
using namespace std;
int main(){
    //木曜日を０とする
    int table[12][31];
    int cnt=0,day;
    for(int i=1; i<=12; i++){
        if(i == 4 || i == 6 || i == 9 || i == 11) day = 30;
        else if(i == 2) day = 29;
        else day = 31;
        for(int j=1; j<=day; j++) {
            if(cnt == 7) cnt = 0;
            table[i-1][j-1] = cnt;
            cnt++;
        }
    }
    int a,b;
    while(cin >> a >> b){
        if(a == 0 && b == 0) break;
        if(table[a-1][b-1] == 0) cout << "Thursday" << endl;
        if(table[a-1][b-1] == 1) cout << "Friday" << endl;
        if(table[a-1][b-1] == 2) cout << "Saturday" << endl;
        if(table[a-1][b-1] == 3) cout << "Sunday" << endl;
        if(table[a-1][b-1] == 4) cout << "Monday" << endl;
        if(table[a-1][b-1] == 5) cout << "Tuesday" << endl;
        if(table[a-1][b-1] == 6) cout << "Wednesday" << endl;
    }
    return 0;
}

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

using namespace std;

int main(){
	

	int dc[13];
	dc[1]=31;
	dc[2]=29;
	dc[3]=31;
	dc[4]=30;
	dc[5]=31;
	dc[6]=30;
	dc[7]=31;
	dc[8]=31;
	dc[9]=30;
	dc[10]=31;
	dc[11]=30;
	dc[12]=31;

	string week[8];
	week[0]="Monday";
	week[1]="Tuesday";
	week[2]="Wendnesday";
	week[3]="Thursday";
	week[4]="Friday";
	week[5]="Saturday";
	week[6]="Sunday";

	int month;
	int day;
	while(cin>>month>>day&&!(month==0&&day==0)){
		int passingDay=2;
		for(int i = 1; i < month; i++){
			passingDay+=dc[i];
		}
		passingDay+=day;
		cout<<week[passingDay%7]<<endl;
	}

	return 0;
}

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

using namespace std;

void getDays(int month, int day)
{
    int dayNum[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int fst=0; // 1/1 ?????? (month-1)??????????????\?????§?????\??°
    for(int i=0; i<month-1; i++)
        fst += dayNum[i];
    fst++; // month???1??\?????§?????\??°
    
    switch(fst % 7) {
        case 0:
            cout << "Wednesday" << endl;
            break;
        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;
        default:
            break;
    }

}

int main(void)
{
    ios::sync_with_stdio(false);
    int month, day;
    while(1) {
        cin >> month >> day;
        if(month == 0) break;
        getDays(month, day);
    }

    return 0;
}

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

using namespace std;

int main(void) {
	int mon[13], m, d, n;
	char w[7][10];
	mon[0] = 0;
	mon[1] = 31;
	mon[2] = 29;
	mon[3] = 31;
	mon[4] = 30;
	mon[5] = 31;
	mon[6] = 30;
	mon[7] = 31;
	mon[8] = 31;
	mon[9] = 30;
	mon[10] = 31;
	mon[11] = 30;
	mon[12] = 31;
	while (cin >> m >> d) {
		if (m == 0 && d == 0) {
			return 0;
		}
		n = 0;
		n += mon[m - 1] + d - 1;
		if (n % 7 == 0) {
		 printf("Thursday\n");
		}
		else if (n % 7 == 1) {
			printf("Friday\n");
		}
		else if (n % 7 == 2) {
			printf("Saturday\n");
		}
		else if (n % 7 == 3) {
			printf("Sunday\n");
		}
		else if (n % 7 == 4) {
			printf("Monday\n");
		}
		else if (n % 7 == 5) {
			printf("Tursday\n");
		}
		else if (n % 7 == 6) {
			printf("Wednesday\n");
		}
	}
}

C++: #include<iostream>
using namespace std;
int main(){
	int mon,day,week;
	while(1){
		cin>>mon>>day;
		if(mon==0)break;
		switch(mon){
			case 1:
			mon=0;
			break;
			case 2:
			mon=31;
			break;
			case 3:
			mon=60;
			break;
			case 4:
			mon=91;
			break;
			case 5:
			mon=121;
			break;
			case 6:
			mon=152;
			break;
			case 7:
			mon=182;
			break;
			case 8:
			mon=213;
			break;
			case 9:
			mon=244;
			break;
			case 10:
			mon=274;
			break;
			case 11:
			mon=305;
			break;
			case 12:
			mon=335;
			break;
		}
		week=(mon+day)%7;
		switch(week){
		    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;
		}
	}
	return 0;
}

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

int main() {
	int mth[12]={31,29,30,30,31,30,31,31,30,31,30,31};
	char wks[][16]={"Wedneday","Thursday","Friday","Sutursday","Sunday",
				"Monday","Tuesday"};
	int m,d;
	while(cin>>m>>d,m){
		int days=0;
		for(int i=0;i<m-1;i++) days+=mth[i];
		days+=d; cout<<wks[days%7]<<endl;
	}
	return 0;
}