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;

int main() {

  int data[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  int month, day;
  while( cin >> month >> day, month + day ) {
    int sum = 0;
    for(int i=0; i<month-1; i++) {
      sum += data[i];
    }
    sum += day;
    sum %= 7;

    if( sum == 1 ) {
      cout << "Thursday" << endl;
    }
    else if( sum == 2 ) {
      cout << "Friday" << endl;
    }
    else if( sum == 3 ) {
      cout << "Saturday" << endl;
    }
    else if( sum == 4 ) {
      cout << "Sunday" << endl;
    }
    else if( sum == 5 ) {
      cout << "Monday" << endl;
    }
    else if( sum == 6 ) {
      cout << "Thuesday" << endl;
    }
 else if( sum == 0 ) {
      cout << "Wednesday" << endl;
    }
  }
}

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

int main(){
  string y[7]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
  int num[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 += num[m-1];
      m--;
    }
    cout << y[d%7] << endl;
  }

  return 0;
}

C++: #include<iostream>
using namespace std;
int a[13][32];
void day(void)
{
    int check=3;
    for(int i=1;i<13;i++){
        for(int j=1;j<32;j++){
            a[i][j]=check;
            check++;
            if(check==7)check=0;
            if((i==4||i==6||i==9||i==11)&&j==30)break;
            else if(i==2&&j==29)break;
        }
    }
}
int main()
{
    int mon,date;
    day();
    while(1){
        cin>>mon>>date;
        if(mon==0&&date==0)break;
        if(a[mon][date]==0)cout<<"Monday\n";
        else if(a[mon][date]==1)cout<<"Tuesday\n";
        else if(a[mon][date]==2)cout<<"Wednesday\n";
        else if(a[mon][date]==3)cout<<"Thursday\n";
        else if(a[mon][date]==4)cout<<"Friday\n";
        else if(a[mon][date]==5)cout<<"Saturday\n";
        else cout<<"Sunday\n";
    }

}

C++: //2004??´???366??\ /1/1 Thursday

#include <cstdio>

using namespace std;

void today(int mon, int day);

int main()
{
	int mon, day;
	
	while (1){
		scanf("%d %d", &mon, &day);
		
		if (day == 0){
			break;
		}
		
		today(mon, day);
	}
	
	return (0);
}

void today(int mon, int day)
{
	int tmp = 0;
	
	for (int i = 1; i < mon; i++){
		if (mon == 4 || mon == 6 || mon == 9 || mon == 11){
			tmp += 30;
		}
		else if (mon == 28){
			tmp += 29;
		}
		else {
			tmp += 31;
		}
	}
	
	switch ((tmp + day) % 7){
	  case 0:
	    puts("Wednesday");
		break;
		
	  case 1:
	    puts("Thursday");
		break;
		
	  case 2:
	    puts("Friday");
		break;
		
	  case 3:
	    puts("Saturday");
		break;
		
	  case 4:
	    puts("Sunday");
		break;
		
	  case 5:
	    puts("Monday");
		break;
		
	  case 6:
	    puts("Tuesday");
		break;
	}
}

C++: #include <iostream>
#include <string>
#include <map>
#include <utility>
using namespace std;
map<pair<int,int>,string> mp;
string s[7]={"Monday","Tuesday","Wendnesday","Thursday","Fryday","Saturday","Sunday"};
int main(){
	int cnt=3;
	for(int i=1;i<=12;i++){
		int days;
		if(i==2)	days=29;
		if(i&1) 	days=(i<=7?31:30);
		else 		days=(i<=7?30:31);
		for(int j=1;j<=days;j++){
			mp[make_pair(i,j)]=s[cnt++];
			cnt%=7;
		}
	}
	int m,d;
	while(true){
		cin>>m>>d;
		if(m==0)	return 0;
		cout<<mp[make_pair(m,d)]<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <string>
#include <functional>
#include <array>
#include <stack>
#include <queue>
#include <chrono>
#include <numeric>
#include <memory.h>
#include <map>
#include <math.h>
#include <utility>
#include <set>

#pragma warning(disable:4996)
using namespace std;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
typedef long long Int;
const double PI = 3.141592653589793238;
const Int INF = 999999999999;
typedef pair<int, int> P;

int S[3][3] = {
		{ 0, 1, 0 },
		{ 1, 1, 1 },
		{ 0, 1, 0 },
};
int M[3][3] = {
		{ 1, 1, 1 },
		{ 1, 1, 1 },
		{ 1, 1, 1 },
};
int L[5][5] = {
		{ 0, 0, 1, 0, 0 },
		{ 0, 1, 1, 1, 0 },
		{ 1, 1, 1, 1, 1 },
		{ 0, 1, 1, 1, 0 },
		{ 0, 0, 1, 0, 0 },
};

string week[7]{
		"Monday",
		"Tuesday",
		"Wednesday",
		"Thursday",
		"Friday",
		"Saturday",
		"Sunday"
};

int dd[11]{3,1,3,2,3,2,3,3,2,3,2};

int main()
{
	int m, d;
	while (cin >> m >> d, m&&d){
		int start = 3;
		int di(0);
		for (int i = 1; i < m; ++i){
			di += dd[i - 1];
		}
		di += (d - 1) % 7;
		di += start;
		di %= 7;
		cout << week[di] << endl;
	}
	return 0;

}

C++: #include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

void solve() {
  vstr days = {
    "Monday",
    "Tuesday",
    "Wednesday",
    "Thursday",
    "Friday",
    "Saturday",
    "Sunday",
  };
  vi32 months = {
    31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,
  };

  while (true) {
    int m, d; cin >> m >> d;
    if (m == 0) return;
    int cnt = d;
    rep(i, m - 1) cnt += months[i];
    cout << days[(cnt + 2) % 7] << '\n';
  }
}