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 = 2014;
    if(m == 1) y = 2013, m = 13;
    if(m == 2) y = 2013, m = 14;
    int D = (d + 26*(m+1)/10 + y + y/4 -2*(y/100) + y/100/4 + 5) % 7;
    cout << s[D] << endl;
  }


  return 0;
}

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

int zeller(int y, int m, int d){
	if( m <= 2){
		y--;
		m += 12;
	}
	return ( ( y + y/4 - y/100 + y/400 + (13*m+8)/5 + d ) % 7);
}

int main(){
	string week[7] = {"Sunday","Mondey","Tuesday","Wednesday","Thursday","Friday","Saturday"};
	int y=2004, m, d;

	while( cin >> m >> d , m ){
		cout << week[ zeller( y , m , d ) ] << endl;
	}
}

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

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

int main(){
	
	int m,d;
	
	while(scanf("%d %d",&m,&d),(m!=0)){
		for(int i=0;i<m;i++){
			d=d+month[i];
		}
		d=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>
#include <string>
using namespace std;
 int main()
{
	//arrays with number of days in month and the days names
    int days[] = {31,29,31,30,31,30,31,31,30,31,30,31};
    string week[7] = {"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
    int month, day;
    while(cin >> month >> day)//entering day
	{
		
        int n = 0;
        for(int i=1; i<month; ++i)
		{
            n += days[i-1];
        }
        n += day;
 
        n %= 7;
        cout << week[n] <<endl;//printing the day
 
    }
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <iomanip>
#include <queue>
#include <stack>
#include <deque>
#include <bitset>
#include <utility>
#include <functional>

using namespace std;

int m, d, A[13] = { 0,0,31,60,91,121,152,182,213,244,274,305,335 };
string s[7] = { "Wednesday", "Thursday","Friday","Saturday","Sunday","Monday","Tuesday" };
int main() {
	while (1) {
		cin >> m >> d;
		if (m == 0) break;
		cout << s[(A[m] + d) % 7] << endl;
	}
	return 0;
}

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

using namespace std;

int main(void){
  int a,b;

  int nday[15] = {0,31,29,31,30,31,30,31,31,30,31,30,31};
  string ans[10] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

  while(true){
    scanf("%d%d", &a,&b);
    if(a == 0 && b == 0)
      break;
    
    int sum = 3;
    for(int i = 1; i < a; i++)
      sum += nday[i];
    sum += b;

    printf("%s\n", ans[sum%7].c_str());

  }
  return 0;
}

C++: #include<cstdio>

int main(){
	int a[] = {0,0,31,60,91,121,152,182,213,244,274,305,335,366};
	int m, d;
	char day[7][10] = {"Monday", "Tuesday", "Wednesday", "Thursday","Friday","Saturday","Sunday"};
	scanf("%d %d", &m, &d);
	while(m || d){
		printf("%s\n", day[(a[m] + d + 2) % 7]);
		scanf("%d %d", &m, &d);
	}
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<cctype>
#include<iomanip>
#include<functional>
#include<numeric>
#define EPS 1e-10
using namespace std;
typedef long long llong;
void whatday(int x, int y) {
	if (x % 7 == y % 7)cout << "Monday" << endl;
	else if (x % 7 == (y + 1) % 7)cout << "Tuesday" << endl;
	else if (x % 7 == (y + 2) % 7)cout << "Wednesday" << endl;
	else if (x % 7 == (y + 3) % 7)cout << "Thursday" << endl;
	else if (x % 7 == (y + 4) % 7)cout << "Friday" << endl;
	else if (x % 7 == (y + 5) % 7)cout << "Saturday" << endl;
	else if (x % 7 == (y + 6) % 7)cout << "Sunday" << endl;
}
int main() {
	int m, d;
	while (cin >> m >> d&&m&&d) {
		int x = 0;
		if (m < 3) {
			x += (m - 1) * 31 + (d - 1);
			whatday(x, 4);
		}
		else {
			x += 31 + 29;// 3/1
			m -= 3; d--;
			x += 61 * (m / 2) + (m % 2) * 31 + d;
			whatday(x, 4);
		}
	}
	return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(){
    int mon,day,ans=0,answer=0,sum[13]={1,31,60,91,121,152,182,213,244,274,305,335,366};
    string date[8]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
    while(cin>>mon>>day){
        if(mon==0)break;
        mon=mon-1;
        if(mon>0){
            ans=day+sum[mon];
        }else{
            ans=day;
        }
        answer=ans%7;
        cout<<date[answer]<<endl;
    }
    return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

int main()
{
	int m, d;
	while(cin >> m >> d && m)
	{
		int month[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

		rep(i, m-1)
			d += month[i];

		switch(d%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;
		}
	}
}