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>
#include<cstdio>
#include<string>
using namespace std;

int main(){
  
  int a,b,day;
  int tuki[12];
  string days[7];
  tuki[0]=31,tuki[1]=29,tuki[2]=31,tuki[3]=30;
  tuki[4]=31,tuki[5]=30,tuki[6]=31,tuki[7]=31;
  tuki[8]=30,tuki[9]=31,tuki[10]=30,tuki[11]=31;
  days[0] = "Wednesday";
  days[1] = "Thursday";
  days[2] = "Friday";
  days[3] = "Saturday";
  days[4] = "Sunday";
  days[5] = "Monday";
  days[6] = "Tuesday";

  while(1){
    day=0;
    cin >> a >> b;
    if(a == 0)break;
    for(int i=1;i<a;i++){
      day += tuki[i-1];
    }
    day += b;
    day %= 7;
    cout << days[day] << endl;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int a,b;
  int day[12] = {0,3,4,0,2,5,0,3,6,1,4,6};
  while(cin >>a>>b,a||b){
    b+=day[a-1];
    switch(b%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;
    }
  }
}

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%7-1] << endl;
	}
}

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

int main(){
  int m, d;
  int t[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  string week[] = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};

  while(cin >> m >> d, m || d){
    int sum = 0;

    for(int i = 0; i < m - 1; i++){
      sum += t[i];
    }
    sum += d;

    cout << week[(sum + 2) % 7] << endl;
  }
}

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

int main(){
  int day30[5] = {3,4,6,9,11};

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

  while(1) {

    if(a == m && b == d) break;
    
    b++;
    count++;

    if(a == 2 && b == 30) {
      a++;
      b = 1;
    }
    else if(b == 31) {
      for(int i=0;i<5;i++) 
	if(day30[i] == a) {
	  a++;
	  b = 1;
	  break;
	}
    }
    if( b == 32) {
      a++;
      b = 1;
    }
  }
  
  if(count % 7 == 4 ) cout <<"Monday"<<endl;
  else if(count % 7 == 5) cout << "Tuesday"<<endl;
  else if(count % 7 == 6) cout <<"Wednesday"<< endl;
  else if(count % 7 == 0) cout <<"Turseday"<< endl;
  else if(count % 7 ==1) cout << "Friday" << endl;
  else if(count % 7 ==2)cout << "Taturday" << endl;
  else if(count % 7 ==3) cout << "Sunday" << endl;
  
  }

  return 0;
}

C++: #include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

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

int main(){
	int m,d,num=3;
	int season[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	while(cin>>m>>d,m){
		rep(i,m-1)num+=season[i];
		num+=d-1;
		num%=7;
		print(num);
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
void daysel(int x){
  switch(x % 7){
  case 6:
  cout << "Tuesday"<<endl; break;
  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;
  }
}
void daycal(int month,int day){
  int x;
  switch(month){
  case 1:
  x = day; break;
  case 2:
  x = 31 + day; break;
  case 3:
  x = 60 + day; break;
  case 4:
  x = 91 + day; break;
  case 5:
  x = 121 + day; break;
  case 6:
  x = 152 + day; break;
  case 7:
  x = 182 + day; break;
  case 8:
  x = 213 + day; break;
  case 9: 
  x = 244 + day;break;
  case 10:
  x = 274 + day;break;
  case 11: 
  x = 305 + day; break;
  case 12:
    x = 335 + day; break;
  }
  daysel(x);

    }
int main(){
  int month,day;
  while(cin >> month >> day && !(month == 0 && day ==0)){   
      daycal(month,day);
  }  
  
}

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

using namespace std;

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

int main()
{
	int m,d;
	int day=0;
	while(1){
		scanf("%d %d",&m,&d);
		if(m==0&&d==0)break;
		day=0;
		for(int i=0;i<m-1;i++){
			day+=month[i];
		}
		day+=d;
		string result;
		const int r=day%7;
		switch(r){
			case 0:
			result="Wednesday";
			break;
		case 1:
			result="Thursday";
			break;
		case 2:
			result="Friday";
			break;
		case 3:
			result="Saturday";
			break;
		case 4:
			result="Sunday";
			break;
		case 5:
			result="Monday";
			break;
		case 6:
			result="Tuesday";
			break;
		}
		cout<<result<<"\n";
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main(){

    int year = 2004,month,day;

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

        if(month == 1 || month==2){
            year--;
            month += 12;
        }
    
        int tmp = (year + year/4 - year/100 + year/400 + (13*month+8)/5 + day)%7;
    
        cout << date[tmp] << endl;
    }
    
    return 0;

}