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++: #define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

#include <bits/stdc++.h>
using namespace std;
int main(){
  
  int vec[12]={31,29,31,30,31,30,31,31,30,31,30,31};
  int m,d,c;
  while(cin>>m>>d){
    if(m==0) break;
    c=0;
    if(m!=1) rep(i,m-1) c+=vec[i];
    c+=d;
    if(c%7==1) cout<<"Thursday"<<endl;
    else if(c%7==2) cout<<"Friday"<<endl;
    else if(c%7==3) cout<<"Saturday"<<endl;
    else if(c%7==4) cout<<"Sunday"<<endl;
    else if(c%7==5) cout<<"Monday"<<endl;
    else if(c%7==6) cout<<"Tuesday"<<endl;
    else if(c%7==0) cout<<"Wednesday"<<endl;
  }
      
  return 0;
}

C++: #include <stdio.h>

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

int main()
{
	int mon,day;
	int ans;
	scanf("%d %d",&mon,&day);
	while(mon != 0 || day != 0){
		ans = 0;
		for(int i = 0; i < mon - 1; i++){
			ans += month[i];
		}
		ans += day;
		ans = ans % 7;
		if(ans == 1){
			printf("Thursday\n");
		}
		if(ans == 2){
			printf("Friday\n");
		}
		if(ans == 3){
			printf("Saturday\n");
		}
		if(ans == 4){
			printf("Sunday\n");
		}
		if(ans == 5){
			printf("Monday\n");
		}
		if(ans == 6){
			printf("Tuesday\n");
		}
		if(ans == 0){
			printf("Wednesday\n");
		}
		scanf("%d %d",&mon,&day);

	}
	return 0;
}

C++: #include <fstream>
#include <iostream>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;

int main() {
  int year[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
  string day[7] = {"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
  int first = 3;

  int m, d;
  while (true) {
    cin >> m >> d;
    if (!(m|d)) break;
    int n = first;
    for (int i = 0; i < m-1; i++) {
      n += year[i];
    }
    n += d-1;

    n %= 7;
    cout << day[n] << endl;
  }
}

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

int m,d;
int data[] = {31,29,31,30,31,30,31,31,30,31,30,31};
string day[] = {"Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"};

int main(){
	while(cin >> m >> d){
		if(m == 0) break;

		for(int i = 0; i < m - 1; i++){
			d+=data[m];
		}
		cout << day[(d-1)%7] << endl;
	}
}

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

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

const int month[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30};
int main()
{
  int m, d, cntdays = 0;
  
  while (cin >> m >> d, m + d){
    cntdays = month[m - 1] + d;
    switch (cntdats % 7){
      case 1:
        cout << "Monday";
        break;
      case 2:
        cout << "Tuesday";
        break;
      case 3:
        cout << "Wednesday";
        break;
      case 4:
        cout << "Thursday";
        break;
      case 5:
        cout << "Friday";
        break;
      case 6:
        cout << "Saturday";
        break;
      case 0:
        cout << "Sunday";
        break;
      cout << endl;
    }
  }
}

C++: #include <iostream>

using namespace std;


int main()
{
    int m[50],d[50];
    int x = 0;
    string Day[7] = {"Thursday", "Friday","Saturday","Sunday","Monday", "Tuesday", "Wednesday"};
    int BanyakHari[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
    int DayinBetween = 0;
    string ThatDayIs[50];

    do
    {
        cin >> m[x] >> d[x];
        if((m[x] == 0) && (d[x] == 0))
        {
            break;
        }
        //Check banyak hari antara 1 Januari - Input
        for(int y = 0; y < m[x]-1; y++)
        {
            DayinBetween = DayinBetween + BanyakHari[y];
        }
        DayinBetween = DayinBetween + d[x] - 1;

        //Kurangi sampai < 7
        while(true)
        {
            if(DayinBetween >= 7)
            {
                DayinBetween = DayinBetween - 7;
            }
            else
            {
                break;
            }
        }

        ThatDayIs[x] = Day[DayinBetween];

        x++;
    }
    while(x < 50);

    for(int z = 0; z < x; z++)
    {
        cout << ThatDayIs[z] << endl;
    }


}

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

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

int from_1_1(int m, int d) 
{
    int day_from_1_1 = d;
    for (int i = 0; i < m; i++) {
        day_from_1_1 += days[i];
    }
    return day_from_1_1;
}

int main(void)
{
    int m, d;
    string day;
    while (cin >> m >> d) {
        if (m == 0 && d == 0) break;
        switch ( from_1_1(m, d) % 7 ) {
            case 1:
                day = "Thursday";
                break;
            case 2:
                day = "Friday";
                break;
            case 3:
                day = "Saturday";
                break;
            case 4:
                day = "Sunday";
                break;
            case 5:
                day = "Monday";
                break;
            case 6:
                day = "Tuesday";
                break;
            case 0:
                day = "Wednesday";
                break;
            default: // DO_NOTHING
                break;
        }
        cout << day << endl;
    }
    return 0;
}

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

int howmany(int);

int main() {
	int month, day, mod;
	

	while (cin >> month >> day) {
		if (month == 0) break;
		int total = 0;

		for (int i = 1;i < month; i++) {
			total += howmany(i);
		}
		total += day;
		mod = total % 7;

		switch (mod) {
		case 0:
			cout << "Wednesday" << endl;
			break;
		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;
		default:
			break;
		}
	}

	return 0;
}

int howmany(int month) {
	if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) {
		return 31;
	}
	else if (month == 2) {
		return 29;
	}
	else {
		return 30;
	}
}

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

int months[] = {31,29,31,30,31,30,31,31,30,31,30,31};
string days[] = {"Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wndnessday"};

int main()
{
	int month,day,sum = 0;
    
    while(cin >> month >> day,month || day)
	{
		for(int i=0;i<month;i++)
		{
	        sum += months[i-1];
		}
        sum += day -1;
		cout << days[sum%7] <<endl;
    }
	return 0;
}

C++: #include <stdio.h>

int main(void)
{
	int MONTH[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	
	char DAYS[7][10] = {"Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"};
	
	int month, date, i;
	
	while(scanf("%d %d",&month, &date)){
		getchar();
		if(month == 0){
			break;
		}
		
		int total = 0;
		for(i = 1;i < month;i++){
			total += MONTH[i - 1];
		} 
		
		total += date -1 ;
		
		//printf("%d\n",total);
		printf("%s\n",DAYS[total % 7]);
	}
	
	return 0;
}