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;

#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 (cntdays % 7){
      case 5:
        cout << "Monday";
        break;
      case 6:
        cout << "Tuesday";
        break;
      case 0:
        cout << "Wednesday";
        break;
      case 1:
        cout << "Thursday";
        break;
      case 2:
        cout << "Friday";
        break;
      case 3:
        cout << "Saturday";
        break;
      case 4:
        cout << "Sunday";
        break;
    }
    cout << endl;
  }
}

C++: #include<stdio.h>
int main(void)
{
	int m[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	int man,day;
	int s;
	int i;
	
	scanf("%d %d",&man,&day);
	while(man!=0){
		s=0;
		if(man!=1){
			for(i=0;i<man-1;i++){
				s+=m[i];
			}
			s+=day;
		}
		else {
			s+=day;
		}
	//	printf("%d\n",s);
		s=s%7;
		if(s==0){
			printf("Wednesday\n");
		}
		else if(s==1){
			printf("Thursday\n");
		}
		else if(s==2){
			printf("Friday\n");
		}
		else if(s==3){
			printf("Saturday\n");
		}
		else if(s==4){
			printf("Sunday\n");
		}
		else if(s==5){
			printf("Monday\n");
		}
		else if(s==6){
			printf("Tuesday\n");
		}
		scanf("%d %d",&man,&day);
	}
	return 0;
}

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

int main() {
	string youbi[7] = {"Wednesday","Thursday","Friday","Suturday","Sunday","Monday","Tuesday"};
	int month[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
	
	int gathu,nichi;
	while ( cin >> gathu >> nichi,gathu ) {
		int keika = 0;
		for ( int i = 0; i < gathu-1; i++ ) {
			keika += month[i];
		}
		keika += nichi;
		
		cout <<  youbi[keika-1 % 7] << endl;
	}
	return 0;
}

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

main(){
	//          0  1  2  3  4  5  6  7  8  9 10 11 12
	int days[]={0,31,29,31,30,31,30,31,31,30,31,30,31};
	
	for(int i=2; i<=12; ++i){
		days[i] += days[i-1];
	}
	
	char day[][20]={
		"Thursday",
		"Friday",
		"Saturday",
		"Sunday",
		"Monday",
		"Tuesday",
		"Wednesday"
	};
	
	while(true){
		// 月, 日
		int m, d;
		cin >> m >> d;
		
		if(m == 0){
			break;
		}
		
		cout << day[(days[m-1]+d-1)%7] <<endl;
	}
}

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

int main()
{
	std::vector<std::string> day_of_week{
		"Thursday",
		"Friday",
		"Suterday",
		"Sunday",
		"Monday",
		"Tuesday",
		"Wednesday"
	};

	std::vector<int> day_num_of_month{
		31,
		29,
		31,
		30,
		31,
		30,
		31,
		31,
		30,
		31,
		30,
		31
	};

	int month = 0;
	int day = 0;

	while (std::cin >> month >> day)
	{
		if (0 == month) { break; }

		int days_elapsed = 0;
		for (int m = 1; m < month; ++m)
		{
			days_elapsed += day_num_of_month[m - 1];
		}
		days_elapsed += day;

		std::cout << day_of_week[day % 7 - 1] << std::endl;
	}

	return 0;
}

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

int main(void){

    string day[7] = {"Monday","tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
    int month[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
    int x,y;

    while(cin >> x >> y){
        if(x == 0){
            break;
        }


        for(int i = 0;i < x-1;i++){
            y += month[i];
        }

        cout << day[(y%7+2)%7] << endl;
    }
    return 0;
}

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

int ary[15];
char str[7][12]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
int main(){
	ary[1]=2;
	for(int i=1;i<12;i++){
		if(i==4||i==6||i==9||i==11){
			ary[i+1]=(ary[i]+30)%7;
		}
		else if(i==2){
			ary[i+1]=(ary[i]+29)%7;
		}
		else{
			ary[i+1]=(ary[i]+31)%7;
		}
	}
	int x,y;
	while(scanf("%d %d",&x,&y)!=EOF){
		if(x==0&&y==0) break;
		cout<<str[(ary[x]+y)%7]<<endl;
	}
	return 0;
}

C++: #include <stdio.h>
#include<math.h>
using namespace std;

int Zeller(int month, int day) {
	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;
}

int main() {

	int month, day;
	while (true) {
		scanf("%d %d", &month, &day);
		if (month == 0)break;

		switch (Zeller(month, day)) {
		case 0:
			printf("Sunday\n");
			break;
		case 1:
			printf("Monday\n");
			break;
		case 2:
			printf("Tuesday\n");
			break;
		case 3:
			printf("Wednesday\n");
			break;
		case 4:
			printf("Thursday\n");
			break;
		case 5:
			printf("Friday\n");
			break;
		case 6:
			printf("Saturday\n");
			break;
		}

	}

	return 0;
}

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

int main(){

  int a[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
  int n,m,d;

  while(cin >> n >> m, n, m){

    d = 0;

    for(int i=0;i<n-1;i++) d = a[i] + d;
 
    d = d + m;

    while(d > 6) d -= 7;
   
    if(d == 5) cout << "Monday" << endl;
    else if(d == 5) cout << "Tuesday" << endl;
    else if(d == 0) cout << "Wednesday" << endl;
    else if(d == 1) cout << "Thursday" << endl;
    else if(d == 2) cout << "Friday" << endl;
    else if(d == 3) cout << "Saturday" << endl;
    else if(d == 4) cout << "Sunday" << endl;

  }
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>

#define rep(i,j,k) for(int i=j;i<k;i++)
#define drep(n,m) for(int i=0;i<n;i++)for(int j=0;j<m;j++)
#define fi first
#define se second
#define vi vector<int>
#define INF 1000000000
#define MOD 1000000009
#define pb push_back
#define mp make_pair
typedef long long ll;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

ll gcd(ll a,ll b){
    if(a<b){
        int t=a;a=b;b=t;
    }
    int c=a%b;
    while(c!=0){
        a=b;
        b=c;
        c=a%b;
    }
    return b;
}

ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}

bool isPrime(int x){
    if(x==1)return false;
    if(x==2)return true;
    if(x%2==0)return false;
    for(int i=3;i<=sqrt(x);i+=2){
        if(x%i==0)return false;
    }
    return true;
}

int main() {
    string day[7]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
    int t=3;
    int v[12]={31,29,31,30,31,30,31,31,30,31,30,31};
    int mo,da;
    while(cin>>mo>>da){
        if(mo==0&&da==0)break;
        rep(i,1,12+1){
            rep(j,1,v[i-1]+1){
                if(i==mo&&j==da){
                    cout<<day[t]<<endl;
                    goto AWAY;   
                }
                t++;
                if(t==7)t=0;
            }
        }
        AWAY:;
        t=3;
    }
    
  
    return 0;
}