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<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<string.h>
#include<vector>
#include<math.h>
#include<queue>
#include <algorithm>
#include<functional>
#include<cstdlib>
#include<cmath>


#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 CI cin >>
#define CO cout <<
#define E << endl;

using namespace std;

typedef pair<int, int> P;
typedef pair<long, long> LP;
typedef pair<int, P> PP;
typedef pair<long, LP> LPP;

int N;

int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };

int day = 0, month = 0;

void input(void) {
	CI day >> month;
	return;
}


int main(void) {
	int weekday = 0;
	int y = 2004;

	string dayname[] = { "Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday" };
	while (true) {
		input();
		if (day == 0) {
			break;
		}
		if (month < 3) {
			y--; month += 12;
		}
		weekday =  (y + y / 4 - y / 100 + y / 400 + (13 * month + 8) / 5 + day) % 7;
		y = 2004;
		CO dayname[weekday] E
	}
	
	return 0;
}

C++: #include<string>
#include<vector>
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<functional>
#include<algorithm>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<cmath>
#include<ctime>
#include<complex>

using namespace std;

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


int main(){

	int a,b;
	while(true){

	cin >> a >> b;
	if(a==0 && b==0) break;

	vector<int>v;

	v.push_back(0);
	v.push_back(31);
	v.push_back(29);
	v.push_back(31);
	v.push_back(30);
	v.push_back(31);
	v.push_back(30);
	v.push_back(31);
	v.push_back(31);
	v.push_back(30);
	v.push_back(31);
	v.push_back(30);
	v.push_back(31);

	int d=b;
	rep(i,a) d+=v[i];

	if(d%7==0) cout << "Wednesday" << endl;
	if(d%7==1) cout << "Thursday" << endl;
	if(d%7==2) cout << "Friday" << endl;
	if(d%7==3) cout << "Saturday" << endl;
	if(d%7==4) cout << "Sunday" << endl;
	if(d%7==5) cout << "Monday" << endl;
	if(d%7==6) cout << "Tuesday" << endl;

	}

	return 0;
}

C++: #include <stdio.h>

int main(void){
	int a,b;
	int day[]={0,31,29,31,30,31,30,31,31,30,31,30,31};

	while(scanf("%d %d",&a,&b),a){
		int youbi=0; // 0ismokuyou
		for(int i=1;i<a;i++) youbi=(youbi+day[i])%7;
		youbi=(youbi+b-1)%7;
		switch (youbi) {
			case 0:
				printf("Thursday\n");
				break;
			case 1:
				printf("Friday\n");
				break;
			case 2:
				printf("Saturday\n");
				break;
			case 3:
				printf("Sunday\n");
				break;
			case 4:
				printf("Monday\n");
				break;
			case 5:
				printf("Tuesday\n");
				break;
			case 6:
				printf("Wednesday\n");
				break;
		}
	}
	return 0;
}

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

int main() {
  int month,day;
  int md[] = { 31,29,31,30,31,30,31,31,30,31,30,31 };
  while ( cin >> month >> day, month || day ) {
    int total = 0;
    for ( int i = 0; i < month-1; i++ ) total += md[i];
    total += day;
    if ( total % 7 == 1 ) cout << "Thursday" << endl;
    else if ( total % 7 == 2 ) cout << "Friday" << endl;
    else if ( total % 7 == 3 ) cout << "Saturday" << endl;
    else if ( total % 7 == 4 ) cout << "Sunday" << endl;
    else if ( total % 7 == 5 ) cout << "Monday" << endl;
    else if ( total % 7 == 6 ) cout << "Tuesday" << endl;
    else if ( total % 7 == 0 ) cout << "Wednesday" << endl;
  }
  return 0;
}

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

int main(){

  int m, d, cnt, d1[12];
  int p[12] = {31, 29, 31, 30, 31, 30,
               31, 31, 30, 31, 30, 31};
  string str[7] = {"Monday", "Tuesday", "Wednesday",
                   "Thursday", "Friday", "Saturday",
                   "Sunday"};
  
  d1[0] = 3;
  for(int i=1; i<12; i++){
    d1[i] = (d1[i-1] + p[i-1]) % 7;
  }

  while(1){
    cin >> m >> d;
    if(m == 0 && d == 0){
      break;
    }
    cout << str[(d1[m-1] + d - 1) % 7] << endl;
  }

  return 0;

}

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

int main() {
	int x, y, t;
	vector<int> X, Y, T;
	while (cin >> x >> y) {
		if (x == 0)break;
		X.push_back(x);
		Y.push_back(y);
	}
	for (int i = 0; i < X.size(); i++) {
		if (X[i] == 1)t = (Y[i] - 1) % 7;
		else if (X[i] == 2)t = (30 + Y[i]) % 7;
		else if (X[i] % 2 == 0) {
			if (X[i] >= 8)t = (((X[i] - 8) / 2) * 61 + Y[i] + 212) % 7;
			else t = (((X[i] - 4) / 2) * 61 + 90 + Y[i]) % 7;
		}
		else {
			if(X[i]>=8)t = (((X[i] - 9) / 2) * 61 + 31 + Y[i]) % 7;
			else t= (((X[i] - 3) / 2) * 61 + 59 + Y[i]) % 7;
		}
		T.push_back(t);
	}
	for (int i = 0; i < T.size(); i++) {
		if (T[i] == 0)cout << "Thursday" << endl;
		else if (T[i] == 1)cout << "Friday" << endl;
		else if (T[i] == 2)cout << "Saturday" << endl;
		else if (T[i] == 3)cout << "Sunday" << endl;
		else if (T[i] == 4)cout << "Monday" << endl;
		else if (T[i] == 5)cout << "Tuesday" << endl;
		else cout << "Wednesday" << 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 && b == 0)
			break;
		if (a == 1 || a == 4 || a == 7) {//
			ans[count] = (b % 7 + 3)%7;
		}
		else if (a == 9 || a == 12) {
			ans[count] = (b % 7 + 2)%7;
		}
		else if (a == 2 || a == 8) {
			ans[count] = (b % 7 + 6)%7;
		}
		else if (a == 3 || a == 11) {
			ans[count] = b % 7;
		}
		else if (a == 5) {//
			ans[count] = (b % 7 + 5)%7;
		}
		else if (a == 6) {//
			ans[count] = (b % 7 + 1)%7;
		}
		else if (a == 10) {
			ans[count] = (b % 7 + 4)%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;
	}
}

C++: #include<stdio.h>
int main()
{
int p[12]={31,29,31,30,31,30,31,31,30,31,30,31};
int M,D,sum;
while(1)
{
sum=0;
scanf("%d",&M);
scanf("%d",&D);if(M==0)break;
if(M==0)break;
for(int i=0;i<M-1;i++)
sum+=p[i];

sum+=D;

switch(sum%7)
{
case 4:
printf("日曜日 Sunday\n");break;
case 5:
printf("月曜日 Monday\n");break;

case 6:
printf("火曜日 Tuesday\n");break;

case 0:
printf("水曜日 Wednesday\n");break;

case 1:
printf("木曜日 Tursday\n");break;

case 2:
printf("金曜日 Friday\n");break;

case 3:
printf("土曜日 Saturday\n");break;
}
}
return 0;
}