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<iostream>
#include<map>
using namespace std;
int day[]={31,29,31,30,31,30,31,31,30,31,30,31};
int main(){
	int m,d;
	map<int,string>v;
	v[0]="Wednesday";
	v[1]="Thursday";
	v[2]="Friday";
	v[3]="Saturday";
	v[4]="Sunday";
	v[5]="Monday";
	v[6]="Tuesday";
	while(cin>>m>>d){
		if(m==0&&d==0)
			break;
		int temp=d;
		for(int i=1;i<m;i++)
			temp+=day[i-1];
		temp%=7;
		cout<<v[temp]<<endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
    out << "{" << p.first << ", " << p.second << "}";
    return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


/* 曜日計算 (0日曜日 - 6土曜日)　*/
int Zeller(ll 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;
}

char dayoftheweek[7][16] = {
  "Sunday",
  "Monday",
  "Tuesday",
  "Wednesday",
  "Thursday",
  "Friday",
  "Saturday"
};

int main(){
  while (1) {
    int y = 2004, m, d;

    scanf("%d%d", &m, &d);

    if (m == 0) break;

    puts(dayoftheweek[Zeller(y, m, d)]);
  }

  return 0;
}

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

// https://github.com/rippro/lib/blob/master/util/date.cpp

using namespace std;
typedef long long ll;

string day[] = {
    "Sunday",
    "Monday",
    "Tuesday",
    "Wednesday",
    "Thursday",
    "Friday",
    "Saturday"
};

string month[] = {
    "January",
    "February",
    "March",
    "April",
    "May",
    "June",
    "July",
    "August",
    "September",
    "October",
    "November",
    "December"
};

ll zeller(long y, long m, long d){
    if (m <= 2){
        y--;
        m += 12;
    }
    return (365 * y) + (y / 4) - (y / 100) + (y / 400) + (306 * (m + 1)) / 10 + d - 429;
}

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

#define loop(i,a,b) for(ll i=(a); i<ll(b); i++)
#define rep(i,b) loop(i,0,b)

int main(){
    int m, d;
    while (cin >> m >> d && m){
        cout << day[(zeller(2004, m, d) + 1) % 7] << endl;
    }
}

C++: #include <iostream>
#include <string>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;


int days[] = {0,31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
string week[] = {"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
 
int main()
{
	int m, d;
    while(cin >> m >> d && m && d)
    {
        int sum = 0;
        rep(i,m)
        {
            sum += days[i];
        }
        sum += d;
        cout << week[(sum)%7] << endl;
    }

    return 0;
}

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

int main() {
	char *weekday[7] = { "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday" };
	int monthdays[12] = { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30 };

	int m, d;
	while (cin >> m >> d, m) {
		int w = d-1;
		for (int i = 1; i < m; i++)
			w += monthdays[i];
		cout << weekday[w%7] << endl;
	}
	
	return 0;
}

C++: #include<iostream>
#include<string>
int main(){
	int month,day;
	int monthday[]={0,31,29,31,30,31,30,31,31,30,31,30,31};
	std::string str[]={"Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"};
	while(1){
		std::cin>>month>>day;
		if(month==0)break;
		int sum=day;
		for(int i=0;i<month;i++)sum+=monthday[i];
		std::cout<<str[sum%7-1]<<std::endl;
	}
	return 0;
	/*
	月曜日 Monday
	火曜日 Tuesday
	水曜日 Wednesday
	木曜日 Thursday
	金曜日 Friday
	土曜日 Saturday
	日曜日 Sunday
	*/
}

C++: #include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <string>
#include <algorithm>
#include <climits>
#include <utility>

#define PRINT(STR) cout << STR << endl;
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
#define REG(i, a, b) for (int (i) = ((int)(a)); (i) < ((int)(b)); i++)
#define ALL(V) (V).begin(), (V).end()
#define SPACE " "

typedef long long ll;

using namespace std;

int nextInt() { int n = -1; cin >> n; return n; }
double nextDouble() { double d = -1; cin >> d; return d; }
ll nextll() { ll n = -1; cin >> n; return n; }
string nextString() { string str; cin >> str; return str; }

int INF = 1LL << 25;
double EPS = 1e-9;

// BEGIN //////////////////////////////////////////////////////////////
int main() {
	const int months[13] = { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
	const string answers[7] =
	{ "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday" };
	while (true) {
		int M = nextInt();
		int D = nextInt();
		if (M == 0) break;
		int past_days = 0;
		for (int i = 1; i < M; i++) {
			past_days += months[i];
		}
		past_days += D;
		PRINT(answers[past_days % 7 - 1]);
	}
	return 0;
}
// END   //////////////////////////////////////////////////////////////

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

using namespace std;

string today(int month, int day){
    string today;
    int startMonth=1, startDay=1, total=0;
    
    for(int i=startMonth; i<month; i++){
        switch(i){
            case 4:
            case 6:
            case 9:
            case 11:
                total += 30;
                break;
            
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                total += 31;
                break;
            case 2:
                total += 29;
                break;
        }
    }
    total += day;
    //cout << total%7 << endl;
    
    switch(total%7){
        case 1:
            today = "Thursday";
            break;
        case 2:
            today = "Friday";
            break;
        case 3:
            today = "Saturday";
            break;
        case 4:
            today = "Sunday";
            break;
        case 5:
            today = "Monday";
            break;
        case 6:
            today = "Tuesday";
            break;
        case 0:
            today = "Wednesday";
            break;
    }
    
    
    return today;
}


int main (int argc, char const* argv[]){
    int month, day, n;
    
    cin >> month >> day;
    while(month!=0 && day!=0){
        
        cout << today(month,day)<< endl;
        cin >> month >> day;
    }
    return 0;
}