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>
using namespace std;

int main() {
	int m,d;
	cin >> m >> d;
	
	while(m!=0 && d!=0){
		int days=0;
		days+=d;
		
		if(m==2)days+=31;
		else if(m==3)days+=60;
		else if(m==4)days+=91;
		else if(m==5)days+=121;
		else if(m==6)days+=152;
		else if(m==7)days+=182;
		else if(m==8)days+=213;
		else if(m==9)days+=244;
		else if(m==10)days+=274;
		else if(m==11)days+=305;
		else if(m==12)days+=335;
		
		days %= 7;
		
		switch(days){
		case 1: cout << "Thursday";break;
		case 2: cout << "Friday" ;break;
		case 3: cout << "Saturday";break;
		case 4: cout << "Sunday";break;
		case 5: cout<<"Monday";break;
		case 6: cout <<"Tuesday";break;
		case 0: cout <<"Wednesday";break;
		
		}
		cout << endl;
		
		cin >> m >> d;
	}
	return 0;
}

C++: #define ll    long long
#define pb    push_back
#define mk    make_pair
#define f     first
#define s     second
#define pii   pair<int, int>
#define fuck  return 0;

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


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

   int m, d;

   while((cin >>m >>d) && (m!=0 && d!=0))
   {
       for(int i=0; i<=m-2; i++) sum+= day[i];


       sum += d;
       int ans = sum % 7;
       cout <<a[ans] << endl;
     sum=0;
   }
}

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

#define YEAR 2004

using namespace std;

int main() {
	vector<string> week;
	week.push_back("Monday");
	week.push_back("Tuesday");
	week.push_back("Wednesday");
	week.push_back("Thursday");
	week.push_back("Friday");
	week.push_back("Saturday");
	week.push_back("Sunday");
	int month[12] = {31,29,31,30,31,30,31,31,30,31,30,31};

	int m,d;
	int index = 3; //1月1日が木曜日なので

	while(cin>>m>>d){
		if(m==0 || d==0){ break; }
		for(int i=0; i<m; i++){
			for(int j=1; j<=month[i]; j++){
				if(i+1==m and j==d){ break; }
				index++;
				if(index == 7) index=0;
			}
		}
		cout<<week[index]<<endl;
		index = 3;
	}
	return 0;
}

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

using namespace std;

int min(){
	string y[7] = {"Wednesday", "Thrsday", "Frinday", "Saturday", "Sunday", "Monday", "Tuesday"};
	int mon[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) break;

		while(m != 0){
			d = d + mon[m-1];
		}
		cout << y[d%7] << endl;
	}
}

C++: 
      case 6:
        printf("Tuesday\n");
        break;
    }
  }

  return 0;
}

C++: #include <iostream>
using namespace std;
int days(int m){
	if(m==1)
		return 0;
	else if(m==2)
		return days(1)+31;
	else if(m==3)
		return 29+days(2);
	else if(m==4)
		return 31+days(3);
	else if(m==5)
		return 30+days(4);
	else if(m==6)
		return 31+days(5);
	else if(m==7)
		return 30+days(6);
	else if(m==8)
		return 31+days(7);
	else if(m==9)
		return 31+days(8);
	else if(m==10)
		return 30+days(9);
	else if(m==11)
		return 31+days(10);
	else if(m==12)
	    return 30+days(11);
}
int main(){
	int m, d;
	while(cin>>m>>d){
		if(m==0)
			break;
		d+=days(m);
		if(d%7==1)
			cout<<"Thursday";
		else if(d%7==2)
			cout<<"Friday";
		else if(d%7==3)
			cout<<"Saturday";
		else if(d%7==4)
			cout<<"Sunday";
		else if(d%7==5)
			cout<<"Monday";
		else if(d%7==6)
			cout<<"Tuesday";
		else
			cout<<"Wednesday";
		cout<<endl;
	}
	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};
  int m,d;

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

    int sum = 0;
    for( int i = 1 ; i < m ; i++ ){
      sum += month[i];
    }

    sum += d; 
    sum %= 7;

    switch(sum){
    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;
    }
  }
  return 0;
}

C++: #include<iostream>
 
int main()
{
	const int dayMaxSum[13] = 
	{
		0,
		31,
		60,
		91,
		121,
		152,
		182,
		213,
		244,
		274,
		305,
		335,
		366
	};

	int month=1,day=0,daySum=0;//month=0で終了するため1で初期化

	while(std::cin >> month >> day && month!=0)
	{
		daySum = dayMaxSum[month-1]+day;

		switch(daySum%7)
		{
		case 1:
			std::cout << "Thursday";
			break;
		case 2:
			std::cout << "Friday";
			break;
		case 3:
			std::cout << "Saturday";
			break;
		case 4:
			std::cout << "Sunday";
			break;
		case 5:
			std::cout << "Monday";
			break;
		case 6:
			std::cout << "Tuesday";
			break;
		case 0:
			std::cout << "Wednesday";
			break;
		}
		std::cout << '\n';

		daySum=0;
	}
}

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

int main() {
	int m, d;
	string week[] = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
			"Saturday", "Sunday" };
	int day[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
	while (cin >> m >> d) {
		if (m == 0)break;
		bool flag=false;
		int mc = 1;
		int cnt = 3;
		while (1) {
			for (int i = 1; i <= day[mc - 1]; ++i, cnt++) {
				if (mc == m && d == i) {
					cout << week[cnt % 7] << endl;
					flag=true;
					break;
				}
			}
			if(flag)break;
			mc++;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <math.h>
#include <stdio.h>
#include <ctype.h>

using namespace std;

int main() {
    int M[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
    string W[7]={"Monday",
        "Tuesday",
        "Wednesday",
        "Thursday",
        "Friday",
        "Saturday",
        "Sunday"};
    
    int x,y;
    while(scanf("%d%d",&x,&y)!=EOF){
        if(x==0||y==0){
            break;
        }
        int day=0;
        for(int i=1; i<x; i++){
            day+=M[i];
        }
        day+=y+2;
        int week = day % 7;
        cout<<W[week]<<endl;
    
    }
    return 0;
}

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

int main() {
	int mth[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
	char wks[][16]={"Wedneday","Thursday","Friday","Saturday","Sunday",
				"Monday","Tuesday"};
	int m,d;
	while(cin>>m>>d,m){
		int days=0;
		for(int i=1;i<m;i++) days+=mth[i];
		days+=d; cout<<wks[days%7]<<endl;
	}
}

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

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

int daysPerMonth[11] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30 };

int main()
{
	int m, d;
	while (cin >> m >> d)
	{
		int day = 0;
		for (int i = 0; i < m - 1; i++)
		{
			day += daysPerMonth[i];
		}
		day += d;

		cout << days[day % 7] << endl;
	}

	return 0;
}