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>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
 
using namespace std;
 
const double eps=1e-10;
 
int main()
{
	int m,d;

	int dd[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
	for(int i=1;i<=12;i++) dd[i]+=dd[i-1];

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

	while(cin>>m>>d,m){
		int day=(d+dd[m-1]+2)%7;
		cout<<str[day]<<endl;
	}

	return 0;
}

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

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

string getDOW(int y, int m, int d) {
    if (m <= 2) {
        --y;
        m += 12;
    }
    int c = y / 100;
    y %= 100;
    int h = d + (26 * (m + 1)) / 10 + y + y / 4 + 5 * c + c / 4;
    return DOW[h % 7];
}

int main() {
    int m, d;
    while (cin >> m >> d, m) {
        cout << getDOW(2004, m, d) << endl;
    }
    return 0;
}

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

int main ()
{
	int m[13]={0,4,7,1,4,6,2,4,7,3,5,1,3};
	string a[7]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
	int M,D;
	while(cin>>M>>D&&M&&D)
	{
		int x=m[M]-2;
		cout<<a[(x+D)%7]<<endl;
		
	}
	
	
	
	
}

C++: //58
#include<iostream>

using namespace std;

int main(){
  int dn[13][32];
  int i=3;
  for(int m=1;m<13;m++){
    static const int dom[]={0,31,29,31,30,31,30,31,31,30,31,30,31};
    for(int d=1;d<=dom[m];d++){
      dn[m][d]=i++;
      i%=7;
    }
  }
  for(int m,d;cin>>m>>d,m;){
    static const char *ds[]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
    cout<<ds[dn[m][d]]<<endl;
  }
  return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int m[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	int man,day;
	int s;
	int i;
	
	scanf("%d %d",&man,&day);
	while(man!=0){
		s=0;
		if(man!=1){
			for(i=0;i<man-1;i++){
				s+=m[i];
			}
			s+=day;
		}
		else {
			s+=day;
		}
		printf("%d\n",s);
		s=s%7;
		if(s==0){
			printf("Wednesday\n");
		}
		else if(s==1){
			printf("Thursday\n");
		}
		else if(s==2){
			printf("Friday\n");
		}
		else if(s==3){
			printf("Saturday\n");
		}
		else if(s==4){
			printf("Sunday\n");
		}
		else if(s==5){
			printf("Monday\n");
		}
		else if(s==6){
			printf("Tuesday\n");
		}
		scanf("%d %d",&man,&day);
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  int s,n,m,p[12]={31,29,31,30,31,30,31,31,30,31,30,31},i;
  string d[] = {"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
  while(cin>>n>>m,n){
    for(s=i=0;i<n-1;i++)s+=p[i];
      cout<<d[(s+m)%7]<<endl;
  }
}

C++: #include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <string>
#include <functional>
#include <array>
#include <stack>
#include <queue>
#include <chrono>
#include <numeric>
#include <memory.h>
#include <map>
#include <math.h>
#include <utility>
#include <set>

#pragma warning(disable:4996)
using namespace std;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
typedef long long Int;
const double PI = 3.141592653589793238;
const Int INF = 999999999999;
typedef pair<int, int> P;

int S[3][3] = {
		{ 0, 1, 0 },
		{ 1, 1, 1 },
		{ 0, 1, 0 },
};
int M[3][3] = {
		{ 1, 1, 1 },
		{ 1, 1, 1 },
		{ 1, 1, 1 },
};
int L[5][5] = {
		{ 0, 0, 1, 0, 0 },
		{ 0, 1, 1, 1, 0 },
		{ 1, 1, 1, 1, 1 },
		{ 0, 1, 1, 1, 0 },
		{ 0, 0, 1, 0, 0 },
};

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

int dd[12]{3,1,3,2,3,2,3,3,2,3,3};

int main()
{
	int m, d;
	while (cin >> m >> d, m&&d){
		int start = 3;
		int di(0);
		for (int i = 1; i < m; ++i){
			di += dd[i - 1];
		}
		di += (d - 1) % 7;
		di += start;
		di %= 7;
		cout << week[di] << endl;
	}
	return 0;

}

C++: #include <iostream>

using namespace std;

int main() {

	int m, d;

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

		switch(m) {
			case 1:
				d+=0;
				break;
			case 2:
				d+=31;
				break;
			case 3:
				d+=60;
				break;
			case 4:
				d+=91;
				break;
			case 5:
				d+=121;
				break;
			case 6:
				d+=152;
				break;
			case 7:
				d+=182;
				break;
			case 8:
				d+=213;
				break;
			case 9:
				d+=244;
				break;
			case 10:
				d+=274;
				break;
			case 11:
				d+=305;
				break;
			case 12:
				d+=335;
		}
 
		d%=7;
		switch(d) {
			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;
		}
	}

	return 0;

}

C++: #include<iostream>
using namespace std;
int s[]={0,0,31,60,91,121,152,182,213,244,274,305,335},a,b;
string t[]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
main()
{
	while(cin>>a>>b,a)cout<<t[(s[a]+b)%7]<<endl;
}

C++: #include<iostream>
using namespace std;
int main(){
  int tuki[13]={0,0,31,60,91,121,152,182,213,244,274,305,335};
  string cal[400];
  cal[1]="Thursday";cal[2]="Friday";cal[3]="Saturday";cal[4]="Sunday";
  cal[5]="Monday";cal[6]="Tuesday";cal[7]="Wednesday";
  for(int i=1;i<=366;i++)
    cal[i+7]=cal[i];
  int a,b;
  while(cin>>a>>b,a+b)
    cout<<cal[tuki[a]+b]<<endl;
  return 0;
}