Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func zeller(month, day int) int {
	year := 2004
	if month == 1 || month == 2 {
		year--
		month += 12
	}
	return (year + year/4 - year/100 + year/400 + (13*month+8)/5 + day)%7
}

func main() {
	scanner.Split(bufio.ScanWords)
	for {
		month := nextInt()
		day := nextInt()
		if month == 0 && day == 0{
			break
		}
		switch zeller(month, day) {
		case 0:
			fmt.Println("Sunday")
		case 1:
			fmt.Println("Monday")
		case 2:
			fmt.Println("Tuesday")
		case 3:
			fmt.Println("Wednesday")
		case 4:
			fmt.Println("Thursday")
		case 5:
			fmt.Println("Friday")
		case 6:
			fmt.Println("Saturday")
		}
	}
}

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

int main() {
	vector<int> r;
	string d[7]={"Saturday","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday"};
	while (true)
	{
		int m,d;
		cin >> m >> d;
		if (m==0)break;
		r.push_back((6+(13*(m+1))/5+d)%7);
	}
	for (int i=0; i<r.size(); i++)
	{
		cout << d[r[i]] << endl;
	}
	return 0;
}

C++: #include <iostream>

int main()
{
    while (true) {
        int m, d;
        std::cin >> m >> d;
        if (m == 0) break;

        const char *weekdays[] = {
            "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"
        };
        const int total_days[] = { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 };
        std::cout << weekdays[(total_days[m - 1] + d - 1) % 7] << std::endl;
    }
}

C++: #include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <cctype>
#include <iostream>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <utility>
using namespace std;
int size(string x){
	string::size_type size=x.size();
	return size;
}
#define fu(l,k) for(int i=l;i<k;i++)
#define fd(l,k) for(int i=l;i>k;i--)
#define sort(ss) sort(ss.begin(), ss.end())
#define rsort(ss) sort(ss.rbegin(), ss.rend())
typedef  vector<string> vs;
typedef  vector<int> vi;
double pi(){
	return M_PI;
}
typedef set<int> set_i;
typedef set<string> set_s;
int INF=1000000;
int main(){
	int m,d,ans;
	string w[7]={"Monday","Tuesday","Wednesday",
	               "Thursday","Friday","Saturday","Sunday"};
	while(1){
		cin>>m>>d;
		if(m==0&&d==0) break;
		if(m==1||m==4||m==7){
			//start:Thursday
			ans=d%7;
			if(ans<3){
				cout<<w[3+ans-1]<<endl;
			}
			else{
				cout<<w[3-7+ans]<<endl;
			}
		}
		if(m==2||m==8){
			//start:Sunday
			ans=d%7;
			cout<<w[7-ans]<<endl;
		}
		if(m==3||m==11){
			//start:Monday
			ans=d%7;
			if(ans==0) cout<<w[6]<<endl;
			else cout<<w[7-ans]<<endl;
		}
		if(m==6){
			//start:Tuesday
			ans=d%7;
			if(ans<1){
				cout<<w[1+ans-1]<<endl;
			}
			else{
				cout<<w[1-7+ans]<<endl;
			}
		}
		if(m==10){
			//start:friday
			ans=d%7;
			if(ans<4){
				cout<<w[4+ans-1]<<endl;
			}
			else{
				cout<<w[4-7+ans]<<endl;
			}
		}
		if(m==5){
			//Saturday
			ans=d%7;
			if(ans<5){
				cout<<w[5+ans-1]<<endl;
			}
			else{
				cout<<w[5-7+ans]<<endl;
			}
		}
		if(m==9||m==12){
			//start:Wednesday
			ans=d%7;
			if(ans<2){
				cout<<w[2+ans-1]<<endl;
			}
			else{
				cout<<w[2-7+ans]<<endl;
			}
		}
	}
}

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

#define REP(i, n) for (int i = 0; i < (n); i++)

const int month[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30};
int main()
{
  int i, m, d;
  
  while (cin >> m >> d, m){
    int cntdays = 0;
    for (i = 0; i < m; i++) cntdays += month[i];
    switch ((cntdays + d) % 7){
      case 0:
        cout << "Wednesday";
        break;
      case 1:
        cout << "Thursday";
        break;
      case 2:
        cout << "Friday";
        break;
      case 3:
        cout << "Saturday";
        break;
      case 4:
        cout << "Sunday";
        break;
      case 5:
        cout << "Monday";
        break;
      case 6:
        cout << "Tuesday";
        break;
    }
    cout << endl;
  }
}

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

C++: #include <algorithm>
#include <iostream>
#include <stdio.h>
#include <stack>

using namespace std;

int main(void){
    int month,day,ans;
    while(1){
        cin >> month >> day;
        if(month==0) break;
        if(month==1){
            ans=day;
        }
        if(month==2){
            ans=day+31;
        }
        if(month==3){
            ans=day+60;
        }
        if(month==4){
            ans=day+91;
        }
        if(month==5){
            ans=day+121;
        }
        if(month==6){
            ans=day+152;
        }
        if(month==7){
            ans=day+182;
        }
        if(month==8){
            ans=day+213;
        }
        if(month==9){
            ans=day+244;
        }
        if(month==10){
            ans=day+274;
        }
        if(month==11){
            ans=day+305;
        }
        if(month==12){
            ans=day+366;
        }
        ans=ans%7;
        if(ans==1) cout << "Thursday" << endl;
        if(ans==2) cout << "Friday" << endl;
        if(ans==3) cout << "Saturday" << endl;
        if(ans==4) cout << "Sunday" << endl;
        if(ans==5) cout << "Monday" << endl;
        if(ans==6) cout << "Tuesday" << endl;
        if(ans==0) cout << "Wednesday" << endl;
    }
    return 0;
}

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

int main(int argc, char **argv)
{
  vector<string> wday = {"Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", };
  int mond_nr[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,};

  int m, d, yday;
  for (;;) {
    cin >> m >> d;
    if (m == 0 && d == 0)
      break;

    yday = 0;
    for (int i = 0; i < m; i++) {
      yday += mond_nr[i];
    }
    yday += (d - 1);
    cout << wday[yday % 7] << endl;
  }
  return 0;
}

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

int main(){
	int tuki, hi, k = 0;
	int nissuu[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
	string youbi[7] = {"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
	string out[100];
	while(cin >> tuki >> hi){
		if(tuki == 0){
			break;
		}
		int a = 0;
		for(int i = 0; i < tuki-1; i++){
			a = a+nissuu[i];
		}
		a = (a+hi)%7;
		out[k] = youbi[a];
		k++;
	}
	for(int i = 0; i < k; i++){
		cout << out[i] << endl;
	}
}

C++: //曜日を当てる
#include<cstdio>
#include<string>

using namespace std;

int main(void){
	string name[7]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
	int mond[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	int month,day,m,c;
	int i;	//ループカウンタ

	while(1){
		scanf("%d %d",&month,&day);
		if(month==0)break;
		m=1;	//月の始めの一月
		c=3;	//始まりは木曜日
		while(1){
			for(i=1;i<=mond[m-1];i++,c++)
				if(month==m && i==day) break;
			if(month==m && i==day) break;
			m++;
		}
		printf("%s\n",name[c%7].c_str());
	}

	return 0;
}

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

int manth[] = {31,29,31,30,31,31,30,31,31,30,31,30,31};
string date[] = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Suterday"};

int main(){
	int M, D;
	while( cin >> M >> D, M ){
		int d = 3;
		for(int i=0; i<M-1; i++ ){
			d += manth[i];
		}
		d += D;
		d %= 7;
		cout << date[d] << endl;
	}
}