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.h>
using namespace std;

main(){
  int m,d;
  int dc,mc;
  string week[7]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
  int month_days[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
  while(cin >> m >> d){
    
    if(m==0 && d == 0)break;
    
    mc=1;
    dc=3;
    while(1){
      
      for(int i=1;i<=month_days[mc];i++,dc++){
	if(m==mc&& d==i)break;
      }
      if(m==mc)break;
      mc++;
    }
    
    cout << week[dc%7]<<endl;
    
    

  }

  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
using namespace std;

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

C++: #include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int T[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	string S[7]={"Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"};
	while(true){
		int M=in(),D=in();
		if(M==0) break;
		int H=0;
		REP(i,M-1){
			H += T[i];
		}
		H+=D-1;
		H%=7;
		out(S[H]);
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int m,d,n=0,date[50]={0},i=0;
	while(cin>>m&&m!=0){
		cin>>d;
		switch(m){
			case 1:
				break;
			case 2:
				d=d+3;
				break;
			case 3:
				d=d+4;
				break;
			case 4:
				d=d+3;
				break;
			case 5:
				d=d+6;
				break;
			case 6:
				d=d+1;
				break;
			case 7:
				d=d+4;
				break;
			case 8:
				break;
			case 9:
				d=d+2;
				break;
			case 10:
				d=d+5;
				break;
			case 11:
				break;
			case 12:
				d=d+3;
				break;
		}
		date[i]=d%7;
		i++;
		n++;
	}
	for(int i=0;i<n;i++){
		switch(date[i]){
			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 "bits/stdc++.h"
using namespace std;

int main() {
	long long X[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
	string Y[7] = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };
	long long M, D;
	while (cin >> M >> D) {
		if (M == 0 && D == 0) return 0;
		M--, D--;
		long long NM = 0, ND = 0, COUNT = 3;
		while (1) {
			if (NM == M && ND == D) break;
			COUNT++;
			ND++;
			if (ND == X[NM]) NM++, ND = 0;
		}
		cout << Y[COUNT % 7] << endl;
	}
}

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

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

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

int main() {

  int m,d;
  while(true) {
    cin>>m>>d;
    if(!m&&!d) break;

    int res=0;
    for(int i=0; i<m-1; i++)
      res += md[i];

    res += d;

    cout<<days[res%7]<<endl;
  }
}

C++: #include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int y, m, d, w;
	
	char* str[7] = {"Sun", "Mon", "Tues", "Wednes", "Thurs", "Fri", "Satur"};
	
	while(1){
		cin >> m >> d;
		y = 2004;
		if(m == 0){
			break;
		}
		if(m == 1 || m == 2 ){
			y--;
			m += 12;
		}
		w = (y+y/4-y/100+y/400+(13*m+8)/5+d)%7;

		cout << str[w] << "day" << endl;
	}
	
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
    string daystr[] = {"Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"};
    int day[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30};
    int m, d;
    while(cin >> m >> d && m){
        for(int i = 0; i < m; i++){
            d += day[i];
        }
        cout <<  daystr[d % 7] << "\n";
    }
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>

#define ll long long int

using namespace std;
typedef pair<int, int> P;

string str;

int main()
{
  int month,date;
  int n[12]={31,29,31,30,31,30,31,31,30,31,30,31};
  int i;

  while(1){
    cin>>month>>date;
    if(month==0)break;
    int day=0;
    for(i=0;i<month-1;i++)
      day+=n[i];
    day+=date;

    switch(day%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>
#include <vector>

using namespace std;
string a[7] = {
  "Monday",
  "Tuesday",
  "Wednesday",
  "Thursday",
  "Friday",
  "Saturday",
  "Sunday"};
int main(void){
  int aa,b;
  int mon[12] = {31,28,
		 31,30,
		 31,30,
		 31,31,
		 30,31,
		 30,31};
  while(cin>>aa>>b,aa+b){
    int d = b;
    for(int i = 0 ; i < aa-1 ; i ++){
      d += mon[i];
      //cout<<d<<endl;
    }

    cout<<a[(d+2)%7]<<endl;
  }
  //*/
}

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

int main()
{
	string days[]={
		"Mon",
		"Tues",
		"Wednes",
		"Thurs",
		"Fri",
		"Satur",
		"Sun"
	};
	int cal[12][31]={{0}};
	int today=3;
	for (int i=0; i<12; i++) {
		for (int j=0; j<31; j++) {
			cal[i][j]=today;
			++today%=7;
			if (i==3 || i== 5 || i==8 || i==10) {
				if (j==29) {
					break;
				}
			}
			else if (j==1) {
				if (j==28) {
					break;
				}
			}
		}
	}
	int a,b;
	for (cin >> a >> b; a || b; cin >> a >> b) {
		cout << days[cal[a-1][b-1]] << "day" << endl;
	}	
}