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<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
#include<cmath>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)


#define X real()
#define Y imag()
typedef complex<double> P;

int main(){
	
	int m[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
	string s[7]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
	while(1){
		int a,b;
		cin>>a>>b;
		if(a==0)break;
		
		int sum = 0;
		rep(i,a)sum+=m[i];
		sum += b;
		
		cout<<s[sum%7]<<endl;
	}
}

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 += day; // 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>
using namespace std;

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

    for(int i=1; i<m; i++) {
      switch(i){
      case 2:
	d+=29;
	break;
      case 4:
      case 6:
      case 9:
      case 11:
	d+=30;
	break;
      default :
	d+=31;
	break;
      }
    }
    switch(d%7){
    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>
#include <string>
using namespace std;

int main(){
	string day[] = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
	int month[] = {31,29,31,30,31,30,31,31,30,31,30,31};
	int m, d;
	while(cin>>m>>d){
		if(!m&&!d) break;
		int dsum = 0;
		for(int i=0; i<m-1; i++){
			dsum += month[i];
		}
		dsum += d - 1;
		cout<<day[(dsum+3)%7]<<endl;
	}
	return 0;
}

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

string check(int d) {
    if (d%7==1) {
        return "Thursday";
    } else if (d%7==2) {
        return "Friday";
    } else if (d%7==3) {
        return "Saturday";
    } else if (d%7==4) {
        return "Sunday";
    } else if (d%7==5) {
        return "Monday";
    } else if (d%7==6) {
        return "Tuesday";
    } else if (d%7==0) {
        return "Wednesday";
    }
}

int main(void){
    int m,d;
    while (cin>>m>>d) {
        if (m==0) {
            break;
        } else {
            if (m==1) {
                cout<<check(d)<<endl;
            } else if (m==2) {
                d=d+31;
                cout<<check(d)<<endl;
            } else if (m==3) {
                d=d+31+29;
                cout<<check(d)<<endl;
            } else if (m==4) {
                d=d+31+29+31;
                cout<<check(d)<<endl;
            } else if (m==5) {
                d=d+31+29+31+30;
                cout<<check(d)<<endl;
            } else if (m==6) {
                d=d+31+29+31+30+31;
                cout<<check(d)<<endl;
            } else if (m==7) {
                d=d+31+29+31+30+31+30;
                cout<<check(d)<<endl;
            } else if (m==8) {
                d=d+31+29+31+30+31+30+31;
                cout<<check(d)<<endl;
            } else if (m==9) {
                d=d+31+29+31+30+31+30+31+31;
                cout<<check(d)<<endl;
            } else if (m==10) {
                d=d+31+29+31+30+31+30+31+31+30;
                cout<<check(d)<<endl;
            } else if (m==11) {
                d=d+31+29+31+30+31+30+31+31+30+31;
                cout<<check(d)<<endl;
            } else if (m==12) {
                d=d+31+29+31+30+31+30+31+31+30+31+30;
                cout<<check(d)<<endl;
            }
        }
    }
}

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

using namespace std;

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

int main() {
	int month, day;
	long AA = 0, BB = 0, CC = 0, DD = 0;

	while (cin >> month >> day) {
		if (month == 0) {
			break;
		}

		AA = 2004;
		if (month < 3) {
			AA--;
			month += 13;
		}
		else {
			month++;
		}

		AA *= 365.25;
		BB = month * 30.6;
		CC = 2004 / 400;
		DD = 2004 / 100;

		AA = AA + BB + CC + day - DD - 429;
		BB = AA / 7;
		AA = AA - (BB * 7);

		cout << today[AA] << endl;
	}
	return 0;
}

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