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 ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    while(true) {
        int m, d; cin >> m >> d;
        if (m == 0)
            break;
        
        vector<string> ans{"Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday"};
        vector<int> months{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        m--;
        int days = 0;
        rep(i, m) {
            days+= months.at(i);
        }
        days+= d;

        cout << (ans.at(days % 7)) << endl;
    }
}

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

int main(){
    int m, d;
    int days[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int mod;
    cin >> m >> d;
    while(m){
        for(int i=m-2;i>=0;i--){
            d += days[i];
        }
        mod = d % 7;
        if(mod == 0){
            cout << "Wednesday" << endl;
        }else if(mod == 1){
            cout << "Thursday" << endl;
        }else if(mod == 2){
            cout << "Friday" << endl;
        }else if(mod == 3){
            cout << "Saturday" << endl;
        }else if(mod == 4){
            cout << "Sunday" << endl;
        }else if(mod == 5){
            cout << "Monday" << endl;
        }else if(mod == 6){
            cout << "Tuesday" << endl;
        }
        cin >> m >> d;
    }
    return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  int m,d;
  while(cin>>m>>d,m+d){
    int day = 0;
    // 2 , 4 , 6 , 9 . 11 
    int month[12] = {31,29,31,30,31,30,
		     31,31,30,31,30,31};
    rep(i,m){
      day+=month[i];
    }
    day=(day + d + 3)%7;
    switch(day){
    case 0:
      cout<<"Thursday"<<endl;
      break;
    case 1:
      cout<<"Friday"<<endl;
      break;
    case 2:
      cout<<"Saturday"<<endl;
      break;
    case 3:
      cout<<"Sunday"<<endl;
      break;
    case 4:
      cout<<"Monday"<<endl;
      break;
    case 5:
      cout<<"Tuesday"<<endl;
      break;
    case 6:
      cout<<"Wednesday"<<endl;
      break;
    }
    

  }
}

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

using namespace std;

int main(){
	int days[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
	//char week1[7][10] = {"??¨?????\","????????\","????????\","??\?????\","????????\","????????\","?°´?????\"};
	char week2[7][10] = {"Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"};

	int month,day;
	int sum;

	while((cin >> month) != 0 && (cin >>day) != 0){
		sum = 0;
		for(int i=0 ;i < month - 1;i++){
			sum += days[i];
		}
		sum += day;

		switch(sum % 7){
			case 1:
				printf("%s\n",week2[0]);
				break;

			case 2:
				printf("%s\n",week2[1]);
				break;

			case 3:
				printf("%s\n",week2[2]);
				break;

			case 4:
				printf("%s\n",week2[3]);
				break;

			case 5:
				printf("%s\n",week2[4]);
				break;

			case 6:
				printf("%s\n",week2[5]);
				break;

			case 0:
				printf("%s\n",week2[6]);
				break;

		}


	}
}

C++: //1=31,2=29,3=31,4=30,5=31,6=30,7=31,8=31,9=30,10=31,11=30,12=31//
#include <iostream>
#include<string>
using namespace std;
int main(){
    string str[7]{"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuseday"};
    int t[11]{31,60,91,121,152,182,213,244,274,305,335};
    //        0   1  2  3   4   5   6  7    8   9   10//
    int d,m;
    while(cin>>m>>d){
        if(m==0)break;
        if(m==1)cout<<str[d%7]<<endl;
        else{
            d=d+t[m-2];
            cout<<str[d%7]<<endl;
        }
    
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	int m,d;
	while(cin>>m>>d){
		if(!m) break;
		int daym[12]={0,31,60,91,121,152,182,213,244,274,305,335};
		int wd = (daym[m-1] + d + 2)%7;
		switch(wd){
		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;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
using namespace std;

#define FOR(i,a,b) for(long long int i=(a);i<(b);i++)
#define REP(i,n) for(long long int i=0;i<(n);i++)
#define ALL(s) (s).begin(),(s).end()

#define PI 3.14159265358479

typedef long long ll;
typedef vector<long long int> vi;
typedef vector<long long int>::iterator vit;

int main(){
	int m, d, c;
	while (cin >> m >> d){
		if (m == 0)break;
		if (m == 1||m==9||m==12)c = 0;
		else if (m ==4||m==7)c = 1;
		else if (m == 10)c = 2;
		else if (m == 2 || m == 5)c = 3;
		else if (m == 8)c = 4;
		else if (m == 11)c = 5;
		else c = 6;
		c = (c + d) % 7;
		if (c == 1){
			cout << "Thursday\n";
		}
		else if (c == 2){
			cout << "Friday\n";
		}
		else if (c == 3){
			cout << "Saturday\n";
		}
		else if (c == 4){
			cout << "Sunday\n";
		}
		else if (c == 5){
			cout << "Monday\n";
		}
		else if (c == 6){
			cout << "Tuesday\n";
		}
		else {
			cout << "Wednesday\n";
		}
	}

}

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

int main(){
	int m[13], mm, dd, i;
	m[0] = 0;
	m[1] = m[0];
	m[2] = m[1] + 31;
	m[3] = m[2] + 29;
	m[4] = m[3] + 31;
	m[5] = m[4] + 30;
	m[6] = m[5] + 31;
	m[7] = m[6] + 30;
	m[8] = m[7] + 31;
	m[9] = m[8] + 31;
	m[10] = m[9] + 30;
	m[11] = m[10] + 31;
	m[12] = m[11] + 30;

	string day[7];
	day[0] = "Wednesday";
	day[1] = "Thursday";
	day[2] = "Friday";
	day[3] = "Saturday";
	day[4] = "Sunday";
	day[5] = "Monday";
	day[6] = "Tuesday";

	while (true)
	{
		cin >> mm >> dd;
		if (mm == 0) { break; }
		i = (m[mm] + dd) % 7;
		cout << day[i] << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
const int year = 2004;

string getDay(int mm, int dd)
{
    int yy = year;
    int ans;
    if(mm <= 2)
    {
        yy -= 1;
        mm += 12;
    }
    ans = (
        dd + ((8+(13 * mm))/5)
        + (yy + (yy / 4) - (yy / 100))
        + (yy / 400)
    ) % 7;

    switch(ans)
    {
        case 0:
            return "Sunday";
        case 1:
            return "Monday";
        case 2:
            return "Tuesday";
        case 3:
            return "Wednesday";
        case 4:
            return "Thursday";
        case 5:
            return "Friday";
        case 6:
            return "Saturday";
    }
}

int main()
{
    int mm, dd;
    while(1)
    {
        cin >> mm >> dd;
        if(mm == 0) break;
        cout << getDay(mm, dd) << endl;
    }

    return EXIT_SUCCESS;
}