Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
	"time"
)

var sc = bufio.NewScanner(os.Stdin)

//Sliceconvtoi ...
func Sliceconvtoi() []int {
	strs := strings.Split(sc.Text(), " ")

	var ints []int
	var x int

	for _, s := range strs {
		x, _ = strconv.Atoi(s)
		ints = append(ints, x)
	}

	return ints
}

func main() {
	for sc.Scan() {
		i := Sliceconvtoi()

		if i[0] == 0 && i[1] == 0 {
			break
		}

		m := time.Month(i[0])
		d := i[1]
		t := time.Date(2004, m, d, 0, 0, 0, 0, time.Local)
		fmt.Println(t.Weekday())
	}

}

C++: //0027 What day is today?

//2004N11ú`1231úÜÅÌútðüÍµ½Æ«A»Ìjúð¦Ä­¾³¢
//È¨2004N11úÍØjúÅA2004NÍ[NÅ·

#include<iostream>
using namespace std;

int main(void)
{
	const char* week[] = 
	{
		"Monday",
		"Tuesday",
		"Wednesday",
		"Thursday",
		"Friday",
		"Saturday",
		"Sunday",
	};
	//indexÌú
	const int Days[] = 
	{
		0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
	};
	int month, day;
	
	while(cin >> month >> day, month)
	{
		cout << week[ (Days[month-1] + day) % 7 + 2] << endl;
	}
	return 0;
}

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


int main() {
  const int n_day[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  const string week_name[] = {
    "Wednesday",
    "Thursday",
    "Firday",
    "Saturday",
    "Sunday",
    "Monday",
    "Tuesday"
  };


  int m, d, sum=0;
  cin >> m >> d;
  while(m != 0 && d != 0) {
    m--;
    for(int i=0; i<m; i++) {
      sum += n_day[i];
    }
    sum += d;
    cout << week_name[sum%7] << endl;
    sum = 0;
    cin >> m >> d;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(void) {
	int Month[13]{
		0,
		31,29,31,30,
		31,30,31,31,
		30,31,30,31
	};
	//??????0?????\???6
	int dow = 2;
	int in_day, in_month;
	while (cin >> in_month >> in_day) {

		if (in_month == 0)break;

		dow = 2;
		for (int i = 0; i < in_month; i++) {
			dow += Month[i];
		}
		dow += in_day;
		if (dow % 7 == 0) {
			cout << "Monthday" << endl;
		}
		else if (dow % 7 == 1) {
			cout << "Tuesday" << endl;
		}
		else if (dow % 7 == 2) {
			cout << "Wednesday" << endl;
		}
		else if (dow % 7 == 3) {
			cout << "Thursday" << endl;
		}
		else if (dow % 7 == 4) {
			cout << "Friday" << endl;
		}
		else if (dow % 7 == 5) {
			cout << "Saturday" << endl;
		}
		else if (dow % 7 == 6) {
			cout << "Sunday" << endl;
		}
	}
	return 0;
}

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

int main() {

  int input1,input2;

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

  while(true) {

    cin >> input1 >> input2;
    if ( input1 == 0 ) break;

    int cnt = 0;

    for ( int i = 0; i < input1-1; i++ ) {
      cnt += days[i];
    }
    cnt += input2-1;

    int week = ( cnt + 3 ) % 7;

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

  }

  return 0;

}

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

int main(void){
	string day[7]={	"Thursday",
 					"Friday",
 					"Saturday",
					"Sunday",
					"Monday",
 					"Tuesday",
 					"Wednesday"
				};
	int month[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
	int m,d;
	while(cin >> m >> d,m|d){
		int r=-1;
		for(int i=0;i<m;i++)
			r+=month[i];
		r+=d;
		r%=7;
		cout << day[r] << endl;
	}
	return 0;
}

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

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

int zeller(int y, int m, int d) {
  if (m < 3) { --y; m += 12; }
  return (y+y/4-y/100+y/400+(13*m+8)/5+d) % 7;
}

int main() {
	int m, n;
	while ( cin >> m >> n, m | n) {
		cout << week[zeller(2004, m, n)] << endl;
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>

typedef long long ll;
using namespace std;

int main()
{
	int days[] = {31,29,31,30,31,30,31,31,30,31,30,31};
	string week[] = {"Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"};

	int a,b;
	while(~scanf("%d %d",&a,&b)){
		if(a==0 && b==0) break;

		int passed=0;
		for(int i=0;i<a - 1;i++){
			passed += days[i];
		}

		passed += b;
		cout << week[(passed - 1) % 7] << endl;
	}
}

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

using namespace std;

int main(){
    int m, d;
    string day[] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
    while (cin >> m >> d) {
        if (!m && !d){
            break;
        }
        int year = 2004, h;
        if (m == 1 || m == 2){
            year--;
            m += 12;
        }
        h = (year + year / 4 - year / 100 + year / 400 + (13 * m + 8) / 5 + d) % 7;
        cout << day[h] << endl;
    }

    return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
 int main()
{
	//arrays with number of days in month and the days names
    int days[] = {31,29,31,30,31,30,31,31,30,31,30,31};
    string week[7] = {"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
    int month, day;
    while(cin >> month >> day, month||day)//entering day
	{
		
        int n = 0;
        for(int i=1; i<month; i++)
		{
            n += days[i-1];
        }
        n += day;
 
        n %= 7;
        cout << week[n] <<endl;//printing the day
 
    }
  return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
enum TheDay {
	Monday = 0, 
	Tuesday = 1,
	Wednesday = 2,
	Thursday = 3,
	Friday = 4,
	Saturday = 5,
	Sunday = 6
};
string getTheDayString(TheDay d){
	switch(d){
	case Monday:	return "Monday";
	case Tuesday:	return "Tuesday";
	case Wednesday: return "Wednesday";
	case Thursday:	return "Thursday";
	case Friday:	return "Friday";
	case Saturday:	return "Saturday";
	case Sunday:	return "Sunday";
	}
	return "";
}
int main()
{
	int MD[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
	int MK[12] = {};
	MK[0] = 3;
	for(int i = 1; i < 12; ++i)
		MK[i] = (MK[i - 1] + MD[i - 1]) % 7;

	int m, d;
	while(cin >> m >> d){
		if(0 == m && 0 == d) break;
		TheDay a = (TheDay)((MK[m-1] + d - 1) % 7);
		cout << getTheDayString(a) << "\n";
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
int main(void){
    int month,day,chek;
    while(std::cin >> month >> day,month){ int year = 2004;
    if(month == 1 || month == 2){year--;month+=12;}
    chek = ((year+ year/4-year/100+year/400+(13*month+8)/5+day)%7);
    switch (chek) {case 0:puts("Sunday");break; case 1:puts("Monday");break; case 2:puts("Tuesday");break; case 3:puts("Wednesday");break;
        case 4:puts("Thursday");break; case 5:puts("Friday");break; case 6:puts("Saturday");break; }}return 0;}

C++: #define scanf_s scanf
//#define gets_s gets
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 10
#define MIN -100001
#define _MAX 10
int main(void)
{
	char *days[7] = { "Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday" };
	int month_sum[12] = { 31,29,31,30,31,30,31,31,30,31,30,31 };
	int month, day, sum = 0;
	while (1) {
		scanf_s("%d %d", &month, &day);
		if (month == 0) break;
		for (int i = 1; i < month; ++i) {
			sum += month_sum[i - 1];
		}
		sum += day;
		printf("%s\n", days[(sum + 2) % 7]);
		sum = 0;
	}
}