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 <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
using namespace std;

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

int m,d;

int main(){
	
	while(cin>>m>>d,!(m==0&&d==0)){
		if(m==2){
			d+=31;
		}
		if(m==3){
			d+=60;
		}
		if(m==4){
			d+=91;
		}
		if(m==5){
			d+=121;
		}
		if(m==6){
			d+=152;
		}
		if(m==7){
			d+=182;
		}
		if(m==8){
			d+=213;
		}
		if(m==9){
			d+=244;
		}
		if(m==10){
			d+=274;
		}
		if(m==11){
			d+=305;
		}
		if(m==12){
			d+=335;
		}
		d = d%7;
		if(d==0) cout<<"Wednesday\n";
		if(d==1) cout<<"Thursday\n";
		if(d==2) cout<<"Friday\n";
		if(d==3) cout<<"Saturday\n";
		if(d==4) cout<<"Sunday\n";
		if(d==5) cout<<"Monday\n";
		if(d==6) cout<<"Tuesday\n";
	}
	return 0;
	
}

C++: #include<iostream>
using namespace std;
int main(){
	int m=0,d=0,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:
				break;
			case 5:
				d=d+2;
				break;
			case 6:
				d=d+5;
				break;
			case 7:
				break;
			case 8:
				d=d+3;
				break;
			case 9:
				d=d+6;
				break;
			case 10:
				d=d+1;
				break;
			case 11:
				d=d+4;
				break;
			case 12:
				d=d+6;
				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<iostream>
using namespace std;
int month[12]={0,3,4,0,2,5,0,3,6,1,4,6};
int main(){
  int m,d;
  while(cin >>m>>d,m||d){
    switch((d+month[m-1])%7){
    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;
    case 0:
      cout <<"Wednesday"<<endl;break;
    }
  }
  return 0;
}

C++: #include<stdio.h>
#include<string>
using namespace std;
int week(int x){
	x++;
	if(x==8)return 1;
	else return x;}
int main(){
	int d[13][32];
	int i,j,k=4;
	for(i=1;i<13;i++){
		if(i==1||i==3||i==5||i==7||i==8||i==10||i==12){
			for(j=1;j<32;j++){
				d[i][j]=k;
				k=week(k);}}
		if(i==2){
			for(j=1;j<30;j++){
				d[i][j]=k;
				k=week(k);}}
		if(i==4||i==6||i==9||i==11){
			for(j=1;j<31;j++){
				d[i][j]=k;
				k=week(k);}}}
	string day[8]={" ","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
	int m,n;
	while(1){
		scanf("%d %d",&m,&n);
		if(m==0&&n==0)break;
		switch(d[m][n]){
			case 1:printf("Monday");break;
			case 2:printf("Tuesday");break;
			case 3:printf("Wednesday");break;
			case 4:printf("Thursday");break;
			case 5:printf("Friday");break;
			case 6:printf("Saturday");break;
			case 7:printf("Sunday");break;}
	printf("\n");}
	return 0;}

C++: #include<iostream>
using namespace std;
int main(){
	int mon,day,week;
	while(1){
		cin>>mon>>day;
		if(mon==0)break;
		switch(mon){
			case 1:
			mon=0;
			break;
			case 2:
			mon=31;
			break;
			case 3:
			mon=60;
			break;
			case 4:
			mon=91;
			break;
			case 5:
			mon=121;
			break;
			case 6:
			mon=152;
			break;
			case 7:
			mon=182;
			break;
			case 8:
			mon=213;
			break;
			case 9:
			mon=244;
			break;
			case 10:
			mon=274;
			break;
			case 11:
			mon=305;
			break;
			case 12:
			mon=335;
			break;
		}
		week=(mon+day)%7;
		switch(week){
		    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;
			 case 0:
			cout<<"?°´?????\ Wednesday"<<endl;
			break;
		}

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

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

using namespace std;

int const Month[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
string const Week[7] = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };

int main(){
	int month, day;

	while (cin >> month >> day){
		if ((month == 0) && (day == 0)) break;
		int today = day;
		month--;
		while (month){
			today += Month[month - 1];
			month--;
		}
		cout << Week[(today + 2) % 7] << endl;
	}

	return 0;
}

C++: #include<iostream>
#include<vector>
#include<string>
using namespace std;
int main(){
	const string day[]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
	const int month[]={31,29,31,30,31,30,31,31,30,31,30,31};
	int m,d,res=2;
	while(cin>>m>>d,m||d){
		for(int i=1;i<m;++i)
			res+=month[i]+1;
		res+=d;
		cout<<day[res%7]<<endl;
	}
	return 0;
}

C++: #include <vector>
#include <utility>
using namespace std;
typedef pair<int,int> MonthDay;
int main(){
  int monthnum[]={
    31,29,31,30,31,30,31,31,30,31,30,31
  };
  const string weekname[]={
    "Monday",
    "Tuesday",
    "Wednesday",
    "Thursday",
    "Friday",
    "Saturday",
    "Sunday"
  };
  vector<MonthDay> data;
  int month,day;
  while(cin>>month>>day){
    if(!month)break;
    data.push_back(MonthDay(month,day));
  }
  for(int i=0;i<data.size();i++){
    int daysum=0;
    for(int j=0;j<data[i].first-1;j++){
      daysum+=monthnum[j];
    }
    daysum+=data[i].second;
    int weekindex=(daysum+2)%7;
    cout<<weekname[weekindex]<<endl;
  }
}