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++: 
import sys
import math

dayy = [0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

def days(a, day):
    if a == 0:
        return day
    else:
        return days(a-1, day + dayy[a])


while 1:
    inp = raw_input().split()
    ii = int(inp[0])
    jj = int(inp[1])
    if ii == 0 and jj== 0:
        break
    ans = days(ii-1, 0) + jj
    ans = ans % 7
    if ans == 1:
        print "Thursday"
        continue
    if ans == 2:
        print "Friday"
        continue
    if ans == 3:
        print "Saturday"
        continue
    if ans == 4:
        print "Sunday"
        continue
    if ans == 5:
        print "Monday"
        continue
    if ans == 6:
        print "Tuesday"
        continue
    if ans == 0:
        print "Wednesday"
        continue

C++: #include <iostream>
#include <cstdio>
using namespace std;
string name[] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
int dayOfWeek(int y, int m, int d) {
    if(m == 1 || m == 2) {
        y--;
        m += 12;
    }
    return(y + y / 4 - y / 100 + y / 400 + (13*m + 8) / 5 + d) % 7;
}

int main(void) {
    int y = 2004, m, d;
    while(scanf("%d %d", &m, &d), m + d != 0) {
        cout << name[dayOfWeek(y, m, d)] << endl;
    }
    return(0);
}

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

using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())

#define rep(i,n) for(int i = 0; i < (n);++i)
#define repc(i,a,b) for(int i = (a);i <(b);++i)
#define repa(n,array) for(auto n :(array))

typedef long long ll ;
typedef vector<int> vi ;
typedef vector<ll> vl ;

constexpr int IMAX = ((1<<30)-1)*2+1 ;
constexpr int INF = 100000000;
double EPS = 1e-10 ;

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int m,d,date = 3;
  while(1){
    cin >> m >> d ;
    if(m == 0){
      break ;
    }
    for(int i = 0;i < m-1;++i){
      date += month[i] % 7 ;
    }
    date += d % 7 - 1 ;
    switch(date%7){
      case 0:
        cout << "Monday" << endl ;
        break;
      case 1:
        cout << "Tuesday" << endl ;
        break;
      case 2:
        cout << "Wednesday" << endl ;
        break;
      case 3:
        cout << "Thursday" << endl ;
        break;
      case 4:
        cout << "Friday" << endl ;
        break;
      case 5:
        cout << "Saturday" << endl ;
        break;
      case 6:
        cout << "Sunday" << endl ;
        break;
      default:
        break;
    }
  }
  return 0;
}

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

int month[] = {31,29,31,30,31,30,31,31,30,31,30,31};
string date[] = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};

int main(){
	int M, D;
	while( cin >> M >> D, M ){
		int d = 3;
		for(int i=0; i<M-1; i++ ){
			d += month[i];
		}
		d += D;
		d %= 7;
		cout << date[d] << endl;
	}
}

C++: #include<iostream>

using namespace std;

int main()
{
	char *week[7]={ "Thursday",
					"Friday",
					"Saturday",
					"Sunday",
					"Monday",
					"Tuesday",
					"Wednesday"};
	int mouse[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	int tuki,day;

	while(cin>>tuki>>day,tuki,day){
		int now=0;
		now+=day-1;
		for(tuki=tuki-2;tuki>=0;tuki--)
			now+=mouse[tuki];
		cout<<week[now%7]<<endl;
	}

	return 0;
}

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

int day(int month){
	switch(month){
		case 4:
		case 6:
		case 9:
		case 11:
			return 30;
			break;
		case 1:
		case 3:
		case 5:
		case 7:
		case 8:
		case 10:
		case 12:
			return 31;
			break;
		case 2:
			return 18;
			break;
	}
}

int main(){
	int m, d, num;
	while(cin >> m >> d, m || d){
		num = 0;
		for(int i=1; i < m; i++){
			num += day(i);
		}
		num += d;
		switch(num % 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;
		}
	}
}

C++: #include<iostream>
using namespace std;
 
int main(){
    int month[]={31,29,31,30,31,30,31,31,30,31,30,31};
    int sum[13];
    char *week[]={"Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"};
    int m,d;
    sum[0]=0;
    for(int i=1;i<=12;i++)sum[i] = sum[i-1]+month[i-1];
    while(cin>>m>>d,m||d)cout<<week[(sum[m-1]+d-1)%7]<<endl;
    return 0;
}

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

int main(void){

    string day[7] = {"Saturday","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday"};
    //int month[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
    int x,y;

    while(cin >> x >> y){
        int h = 20;
        int n = 4;
        if(x == 0){
            return 0;
        }
        if(x == 1 || x == 2){
            n--;
            x+=12;
        }
                       
        int w = n + n/4 + h/4 - 2*h + 13*(x+1)/5 + y;
        //cout << w << endl;
       
        //cout << w%7 << endl;

        string ans = day[w%7];

        cout << ans << endl;
    }
    return 0;
}

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

using namespace std;

int main (void) {
	int months[12];
	
	months[ 1 - 1] = 31;
	months[ 2 - 1] = 29;
	months[ 3 - 1] = 31;
	months[ 4 - 1] = 30;
	months[ 5 - 1] = 31;
	months[ 6 - 1] = 30;
	months[ 7 - 1] = 31;
	months[ 8 - 1] = 31;
	months[ 9 - 1] = 30;
	months[10 - 1] = 31;
	months[11 - 1] = 30;
	months[12 - 1] = 31;
	
	string days[7] = {
		"Thursday",
		"Friday",
		"Saturday",
		"Sunday",
		"Monday",
		"Tuesday",
		"Wednesday"
	};
	
	for (;;) {
		int m, d, dSum;
		cin >> m;
		cin >> d;
		
		if (m == 0 && d == 0) {
			break;
		}
		
		dSum = 0;
		for (int i = 0; i < m - 1; i ++) {
			dSum += months[i];
		}
		
		dSum += d - 1;
		
		cout << days[dSum % 7] << endl;
	}
	
	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string.h>
#include <queue>
#include <stack>
#include <utility>
#include <queue>
#include <cmath>
#define mp make_pair
#define pii pair<int,int> 
#define ff first
#define ss second

using namespace std;

int month[20]={0,31,29,31,30,31,30,31,31,30,31,30,31};
string days[10]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
int a,b,c;
int main()
{
	while(1)
	{
		scanf("%d %d",&a,&b);
		c=0;
		if(a==0&&b==0)
		{
			break;
		}
		for(int i=1;i<a;i++)
		{
			c+=month[i];
		}
		c+=b+2;
		c%=7;
		printf("%d\n",c);
		cout<<days[c]<<endl;
	}
	return 0;
}