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>

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

using namespace std;
using ll = long long int;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using edge = struct
{
    int to, cost;
};

const int MOD = 1e9 + 7;
const int iINF = 1e9;
const long long int llINF = 1e18;
const double PI = acos(-1.0);

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    vector<int> day = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

    REP(i, 1, 12) day[i] += day[i - 1];

    int month, da;

    while(cin >> month >> da, month)
    {
        string ans;
        switch((day[month - 1] + da) % 7)
        {
            case 0:
                ans = "Wednesday";
                break;
            case 1:
                ans = "Thursday";
                break;
            case 2:
                ans = "Friday";
                break;
            case 3:
                ans = "Saturday";
                break;
            case 4:
                ans = "Sunday";
                break;
            case 5:
                ans = "Monday";
                break;
            case 6:
                ans = "Tuesday";
                break;
        }

        cout << ans << endl;
    }

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)):((m)-(n))),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)
#define loop for(;;)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;
typedef vector<int> vi;
typedef vector<string> vs;
typedef map<string,int> Dictionary;
const Real PI = acos(-1);

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

int dx[] = { -1, 0, 1, 0 };
int dy[] = {  0, -1, 0, 1 };

enum Day {
  Sat = 0,
  Sun = 1,
  Mon, Tue, Wed, Thu, Fri
};

Day zeller(int y, int m, int d) {
  if (m == 1 || m == 2) {
    --y; m += 12;
  }
  int Y = y % 100;
  int c = y / 100;
  int gamma = 5 * c + c / 4; // Gregorian (1582 <= y)
  //int gamma = 6 * c + 5; // Julian (4 <= y <= 1582)
  int h = d + int(26 * (m+1) / 10)
    + Y + Y / 4 + gamma;
  h %= 7;
  return Day(h);
}

string show_day (Day a) {
  switch (a) {
    case Mon: return "Monday";
    case Tue: return "Tuesday";
    case Wed: return "Wednesday";
    case Thu: return "Thursday";
    case Fri: return "Friday";
    case Sat: return "Saturday";
    case Sun: return "Sunday";
    default: return "Holiday";
  }
}

int main() {

  loop {
    int a,b;
    cin >> a >> b;
    if (!cin) break;
    if (!a && !b) break;
    cout << show_day(zeller(2004, a, b)) << endl;
  }
  return 0;
}

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

int main(int argc, char *argv[]) {
	const int start_day = 3;
	const int days[12] = {
		31, 29, 31, 30, 31, 30,
		31, 31, 30, 31, 30, 31
	};
	const std::string week[] = {
		"Monday", "Tuesday", "Wednesday", "Thursday",
		"Friday", "Saturday", "Sunday"
	};
	
	while (true) {
		int month, day, sum = start_day;
		fscanf(stdin, "%d %d", &month, &day);
		if (month == 0) {
			break;
		}
		sum += day-1;
		for (int i = 0; i < month-1; i++) {
			sum += days[i];
		}
		printf("%s\n", week[sum%7].c_str());
		
	}
	return 0;
}

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

double r(double x1,double y1,double x2,double y2){
	return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
	
	}

int main() {
	// your code goes here
int a[13];
a[1]=31;
a[2]=29;
a[3]=31;
a[4]=30;
a[5]=31;
a[6]=30;
a[7]=31;
a[8]=31;
a[9]=30;
a[10]=31;
a[11]=30;
a[12]=31;

int m,d,z,y;
cin>>m>>d;
while(m!=0){
	if(m==0) z=d;
	else{
		z=d;
		for(int i=1;i<m;i++){
			z=z+a[i];
		}
	}
	y=z%7;
	if(y==1){
		cout<<"Thursday"<<endl;
	}
		if(y==2){
		cout<<"Friday"<<endl;
	}
		if(y==3){
		cout<<"Saturday"<<endl;
	}
		if(y==4){
		cout<<"Sunday"<<endl;
	}
		if(y==5){
		cout<<"Monday"<<endl;
	}
		if(y==6){
		cout<<"Tuesday"<<endl;
	}
		if(y==0){
		cout<<"Wednesday"<<endl;
	}
	
	cin>>m>>d;
}
	
	return 0;
}

C++: #include <stdio.h>

int zeller(int y, int m, int d){
	if(m <= 2){
		y--;
		m += 12;
	}

	int J = (int)(y/100);
	int K = y - (int)(y/100)*100;

	return (d + (int)((m+1)*26/10) + K + (int)(K/4) + (int)(J/4) + 5 * J + 5) % 7;
}

int main(void){
	int y, m, d;
	y = 2004;
	char *wday[7] = {
		"Monday",
		"Tuesday",
		"Wednesday",
		"Thursday",
		"Friday",
		"Saturday",
		"Sunday",
	};
	while(true){
		scanf("%d %d", &m, &d);
		if(m == 0){ break; }
		int w = zeller(y, m , d);
		puts(wday[w]);
	}
	return 0;
}

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

C++: #include <stdio.h>

static const char *days[7]=
{
    "Sunday",
    "Monday",
    "Tuesday",
    "Wednesday",
    "Thursday",
    "Friday",
    "Saturday",
    
};

int main(void)
{
    int base=4;
    int monthbase[12]=
    {0,3,4,0,2,5,0,3,6,1,4,6,};
    while(1)
    {
        int m,d;
        scanf("%d%d",&m,&d);
        if(m==0)
            break;
        puts(days[(base+monthbase[m-1]+d-1)%7]);
    }
    return 0;
}

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

using namespace std;

int min(){
	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) break;

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

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

using namespace std;

int main()
{
  int days[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

  int month, day;
  while(true)
  {
    cin >> month >> day;
    if(!month)
      break;
    switch((days[month - 1] + day - 1) % 7)
    {
    case 0:
      cout << "Thursday";
      break;
    case 1:
      cout << "Friday";
      break;
    case 2:
      cout << "Saturday";
      break;
    case 3:
        cout << "Sunday";
      break;
    case 4:
      cout << "Monday";
      break;
    case 5:
      cout << "Tuesday";
      break;
    case 6:
      cout << "Wednesday";
    }
    cout << endl;
  }

  return 0;
}