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 <vector>
#include <string>

int main()
{
	std::vector<std::string> day_of_week{
		"Thursday",
		"Friday",
		"Suterday",
		"Sunday",
		"Monday",
		"Tuesday",
		"Wednesday"
	};

	std::vector<int> day_num_of_month{
		31,
		29,
		31,
		30,
		31,
		30,
		31,
		31,
		30,
		31,
		30,
		31
	};

	int month = 0;
	int day = 0;

	while (std::cin >> month >> day)
	{
		if (0 == month) { break; }

		int days_elapsed = 0;
		for (int m = 1; m < month; ++m)
		{
			days_elapsed += day_num_of_month[m - 1];
		}
		days_elapsed += day;

		std::cout << day_of_week[days_elapsed % 7 - 1] << std::endl;
	}

	return 0;
}

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

using namespace std;

int main(){
	string y[7] = {"Wednesday", "Thrsday", "Frinday", "Saturday", "Sunday", "Monday", "Tuesday"};
	int mon[13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

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

		while(m != 0){
			d += mon[m-1];
			m--;
		}
		cout << y[d%7] << endl;
	}
}

C++: #include <stdio.h>
#include <string.h>
#include <time.h>

int
main(void)
{
	char line[80];

	int m, d;
	
	while (true) {
		if (fgets(line, sizeof line, stdin) == NULL) {
			return 0;
		}
		if (sscanf(line, "%d %d", &m, &d) != 2) {
			return 0;
		}

		if (m == 0) {
			return 0;
		}
		
		struct tm tm0;
		memset(&tm0, 0, sizeof tm0);
		
		tm0.tm_year = 2004-1900;
		tm0.tm_mon = m - 1;
		tm0.tm_mday = d;

		time_t t = mktime(&tm0);
		
		struct tm* tm1 =localtime(&t);
		
		strftime(line, sizeof line, "%A", tm1);

		printf("%s\n", line);
	}

	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
int m,d,h,y=4;
char w[][7]={"Satur","Sun","Mon","Tues","Wednes","Thurs","Fri"};
for(;;){
cin>>m>>d;
if(m==0)break;
if(m<3){m+=12;y--;}
h=(y+int(y/4)+int(20/4)-2*20+int(13*(m+1)/5)+d)%7;
cout<<w[h]<<"day"<<endl;
}
return 0;
}

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

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int day_month[]={0,31,29,31,30,31,30,31,31,30,31,30,31};
char day[10][10]={
  {"Thursday"},
  {"Friday"},
  {"Saturday"},
  {"Sunday"},
  {"Monday"},
  {"Tuesday"},
  {"Wednesday"},
};
int main(){
  int m,d,count;
  while(1){
    cin >> m >> d;
    if(!m && !d)break;
    count = -1;
    for(int i=1;i<=m;i++){
      if(i == m){
	for(int j=1;j<=d;j++){
	  count++;
	}
      }else {
	for(int j=1;j<=day_month[i];j++){
	  count++;
	}
      }
    }
    cout << day[count % 7] << endl;
  }
}

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

int main()
{
	int month[] = {
		0, 31, 29, 31, 30, 31, 30,
		31, 31, 30, 31, 30, 31
	};
	int m, d;
	while(cin >> m >> d){
		if(m == 0) break;
		int days = 0;
		for(int i = 1; i < m; i++) days += month[i];
		days += d;
		days = days % 7;
		switch(days){
		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>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>
#include<iomanip>
 
#define EPS (1e-10)
using namespace std;
#define PI (3.1415926535)

int main(){
	string day[] = {"Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday"};

	int month[] = {0, 31, 29, 31,
		30, 31, 30,
		31, 31, 30,
		31, 30, 31};

	int m, d;
	while(cin >> m >> d){
		if(m == 0 && d == 0){
			break;
		}
		for(int i = 1; i < m; i++){
			d += month[i];
		}

		cout << day[d%7] << endl;
	}

	return 0;
}

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

int main()
{
  int m,d;
  string week[7] = {"Thursday", "Friday", "Saturday", "Sunday","Mondy", "Tuesday", "Wednesday"};
  int month[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  
  while (scanf("%d %d", &m, &d)) {
    if (m+d == 0) { break; };
    int day = 0;
    for (int i = 0; i < (m - 1); i++) {
      day += month[i];
    }
    day += d;
    cout << week[(day%7)-1] << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<queue>
#include <climits>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int mod = 1e9 + 7;
const long long INF = 1LL << 60;


int date[12][31];
string day[7] = {"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};

int main() 
{
    for(int i = 0; i < 12; i++){
        for(int j = 0; j < 31; j++){
            date[i][j] = 0;
        }
    }
    for(int i = 0; i < 12; i++){
        if(i == 3 || i == 5 || i == 8 || i == 10){
            for(int j = 0; j < 30; j++){
                date[i][j] = 1;
            }
        }else if(i == 1){
            for(int j = 0; j < 29; j++){
                date[i][j] = 1;
            }
        }else{
            for(int j = 0; j < 31; j++){
                date[i][j] = 1;
            }
        }
    }
    while(true){
        int cnt = 0;
        int m,d;
        cin >> m >> d;
        if(m==0 && d == 0) break;
        m--; d--;
        for(int i = 0; i < 12; i++){
            for(int j = 0; j < 31; j++){
                if((i < m || (i == m && j <= d)) && date[i][j] == 1){
                    cnt++;
                }
            }
        }
        cnt += 2;
        cout << day[cnt%7] << endl;
    }
}

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,a+b){
    int d = b;
    for(int i = 0 ; i < aa-1 ; i ++){
      d += mon[i];
      cout<<d<<endl;
    }

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