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<bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T1, class T2> inline void minup(T1& m, T2 x){ if(m>x) m=static_cast<T2>(x); }
template<class T1, class T2> inline void maxup(T1& m, T2 x){ if(m<x) m=static_cast<T2>(x); }

#define INF 1000000000
#define MOD 1000000007
#define EPS 1E-12

string s[] = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
int y, m, d;

int main()
{
  while((cin >> m >> d) && m){
    y = 2004;
    if(m == 1) y = 2003, m = 13;
    if(m == 2) y = 2003, m = 14;
    int D = (d + 26*(m+1)/10 + y + y/4 +5*(y/100) + y/100/4 + 4) % 7;
    cout << s[D] << endl;
  }


  return 0;
}

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

int days[13] = { 0,31,29,31,30,31,30,31,31,30,31,30,31};
string ans[10] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
int main()
{

int month, date;

	//前月までの延べ日数に変換
	for( int i = 1; i < 13; i++ ) {
		days[i] += days[i-1];
	}

	while( cin >> month >> date ) {
		if( month == 0 )
			return -1;
		
		int day = days[month-1] + date + 3;
		int p = day %7;

		cout << ans[p].c_str() << endl;

	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
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), m != 0 ) {
    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 <stdio.h>

int main()
{
	int month, day, n;
	int md[12] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 31, 30};

	while (1) {
		scanf("%d %d", &month, &day);

		if (month == 0) break;
		n = 0;

		for (int i = 0; i < month; i++) {
			n += md[i];
		}
		n += day;

		switch (n%7) {
			case 0: printf("Wednesday\n"); break;
			case 1: printf("Thursday\n"); break;
			case 2: printf("Friday\n"); break;
			case 3: printf("Saturday\n"); break;
			case 4: printf("Sunday\n"); break;
			case 5: printf("Monday\n"); break;
			case 6: printf("Tuesday\n"); break;
		}
	}

	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int m,d;
  while(cin >> m >> d){
    if(m==0)
      break;
    int cd=d;
    for(int i=1;i<=m;i++){
      switch(i){
      case 2:cd+=31;break;
      case 3:cd+=29;break;
      case 4:cd+=31;break;
      case 5:cd+=30;break;
      case 6:cd+=31;break;
      case 7:cd+=30;break;
      case 8:cd+=31;break;
      case 10:cd+=30;break;
      case 9:cd+=31;break;
      case 11:cd+=31;break;
      case 12:cd+=30;break;
      }
    }
    switch(cd%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;

int main() {
	vector<int> r;
	string d[7]={"Saturday","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday"};
	while (true)
	{
		int m,d;
		cin >> m >> d;
		if (m==0)break;
		if (m<3)m+=12;d-=2;
		r.push_back((5+d+(13*(m+1))/5)%7);
	}
	for (int i=0; i<r.size(); i++)
	{
		cout << d[r[i]] << endl;
	}
	return 0;
}

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

char *Whatday(int a,int b){
	char *day;
	int date=0;
	int month[]={
		0,31,29,31,30,31,30,31,31,30,31,30,31
	};
	
	for(int i=1;i<a;i++){
		date = date+month[i];
	}
	date += b;
	switch(date%7){
		case 0: day ="Wednesday"; break;
		case 1: day ="Thursday"; break;
		case 2: day ="Friday"; break;
		case 3: day ="Saturday"; break; 
		case 4: day ="Sunday"; break;
		case 5: day ="Monday"; break;
		case 6: day ="Tuesday"; break;
	}
	return day;
}

int main() {
	int m,d;
	while(1){
		cin >> m >> d;
		if(m==0) break;
		cout << Whatday(m,d) << endl;
	}
	return 0;
}

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

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef pair<int, int> P;
typedef long long ll;

const int INF = 1 << 30;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int month[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

bool leap(int y)
{
	return ((y%4==0&&y%100!=0)||y%400==0);
}

#define debug(a, b, c) for(int i = 0; i < b; i++){for(int j = 0; j < c; j++){printf("%3d", a[i][j]);}puts("");}puts("-----------------------------------------");

int main()
{
	int month, day, res;
	string week[] = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
	while(cin >> month >> day)
	{
		int year = 2004;
		if(!month && !day) break;
		if(month == 1 || month == 2)
		{
			year--;
			month += 12;
		}
		res = (5*year/4 - year/100 + year/400 + (26*month + 16)/10 + day) % 7;
		cout << week[res] << endl;
	}
}

C++: # include <stdio.h>
#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), m != 0 ) {
    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>

using namespace std;

int main()
{ 
	const string day[7] = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };
	const int days[13] = { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30 };

	int month, date;

	while (cin >> month >> date, month)
	{
		int sum = 0;
		for (int i = 1; i < month; ++i)
			sum += days[i];

		sum += date;
		cout << day[sum % 7 + 2] << endl;
	}

	return 0;
}