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++: //31,29,31,30,31,30,31,31,30,31,30,31//
#include <iostream>
using namespace std;
int main(){
    int i,j,d,m;
    while(cin>>m>>d){
        if(m==0&&d==0)break;
        if(m==1){
            if(d%7==1)cout<<"Thursday"<<endl;
            else if(d%7==2)cout<<"Fridy"<<endl;
            else if(d%7==3)cout<<"Saturday"<<endl;
            else if(d%7==4)cout<<"Sunday"<<endl;
            else if(d%7==5)cout<<"Monday"<<endl;
            else if(d%7==6)cout<<"Tuesday"<<endl;
            else if(d%7==0)cout<<"Wednesday"<<endl;
        }
        if(m==2){
            d=d+31;
            if(d%7==1)cout<<"Thursday"<<endl;
            else if(d%7==2)cout<<"Fridy"<<endl;
            else if(d%7==3)cout<<"Saturday"<<endl;
            else if(d%7==4)cout<<"Sunday"<<endl;
            else if(d%7==5)cout<<"Monday"<<endl;
            else if(d%7==6)cout<<"Tuesday"<<endl;
            else if(d%7==0)cout<<"Wednesday"<<endl;
        }
        if(m==3){
            d=d+60;
            if(d%7==1)cout<<"Thursday"<<endl;
            else if(d%7==2)cout<<"Fridy"<<endl;
            else if(d%7==3)cout<<"Saturday"<<endl;
            else if(d%7==4)cout<<"Sunday"<<endl;
            else if(d%7==5)cout<<"Monday"<<endl;
            else if(d%7==6)cout<<"Tuesday"<<endl;
            else if(d%7==0)cout<<"Wednesday"<<endl;
        }
        if(m==4){
            d=d+91;
            if(d%7==1)cout<<"Thursday"<<endl;
            else if(d%7==2)cout<<"Fridy"<<endl;
            else if(d%7==3)cout<<"Saturday"<<endl;
            else if(d%7==4)cout<<"Sunday"<<endl;
            else if(d%7==5)cout<<"Monday"<<endl;
            else if(d%7==6)cout<<"Tuesday"<<endl;
            else if(d%7==0)cout<<"Wednesday"<<endl;
        }
        if(m==5){
            d=d+121;
            if(d%7==1)cout<<"Thursday"<<endl;
            else if(d%7==2)cout<<"Fridy"<<endl;
            else if(d%7==3)cout<<"Saturday"<<endl;
            else if(d%7==4)cout<<"Sunday"<<endl;
            else if(d%7==5)cout<<"Monday"<<endl;
            else if(d%7==6)cout<<"Tuesday"<<endl;
            else if(d%7==0)cout<<"Wednesday"<<endl;
        }
        if(m==6){
            d=d+151;
            if(d%7==1)cout<<"Thursday"<<endl;
            else if(d%7==2)cout<<"Fridy"<<endl;
            else if(d%7==3)cout<<"Saturday"<<endl;
            else if(d%7==4)cout<<"Sunday"<<endl;
            else if(d%7==5)cout<<"Monday"<<endl;
            else if(d%7==6)cout<<"Tuesday"<<endl;
            else if(d%7==0)cout<<"Wednesday"<<endl;
        }
        if(m==7){
            d=d+181;
            if(d%7==1)cout<<"Thursday"<<endl;
            else if(d%7==2)cout<<"Fridy"<<endl;
            else if(d%7==3)cout<<"Saturday"<<endl;
            else if(d%7==4)cout<<"Sunday"<<endl;
            else if(d%7==5)cout<<"Monday"<<endl;
            else if(d%7==6)cout<<"Tuesday"<<endl;
            else if(d%7==0)cout<<"Wednesday"<<endl;
        }
        if(m==8){
            d=d+212;
            if(d%7==1)cout<<"Thursday"<<endl;
            else if(d%7==2)cout<<"Fridy"<<endl;
            else if(d%7==3)cout<<"Saturday"<<endl;
            else if(d%7==4)cout<<"Sunday"<<endl;
            else if(d%7==5)cout<<"Monday"<<endl;
            else if(d%7==6)cout<<"Tuesday"<<endl;
            else if(d%7==0)cout<<"Wednesday"<<endl;
        }
        if(m==9){
            d=d+243;
            if(d%7==1)cout<<"Thursday"<<endl;
            else if(d%7==2)cout<<"Fridy"<<endl;
            else if(d%7==3)cout<<"Saturday"<<endl;
            else if(d%7==4)cout<<"Sunday"<<endl;
            else if(d%7==5)cout<<"Monday"<<endl;
            else if(d%7==6)cout<<"Tuesday"<<endl;
            else if(d%7==0)cout<<"Wednesday"<<endl;
        }
        if(m==10){
            d=d+273;
            if(d%7==1)cout<<"Thursday"<<endl;
            else if(d%7==2)cout<<"Fridy"<<endl;
            else if(d%7==3)cout<<"Saturday"<<endl;
            else if(d%7==4)cout<<"Sunday"<<endl;
            else if(d%7==5)cout<<"Monday"<<endl;
            else if(d%7==6)cout<<"Tuesday"<<endl;
            else if(d%7==0)cout<<"Wednesday"<<endl;
        }
        if(m==11){
            d=d+304;
            if(d%7==1)cout<<"Thursday"<<endl;
            else if(d%7==2)cout<<"Fridy"<<endl;
            else if(d%7==3)cout<<"Saturday"<<endl;
            else if(d%7==4)cout<<"Sunday"<<endl;
            else if(d%7==5)cout<<"Monday"<<endl;
            else if(d%7==6)cout<<"Tuesday"<<endl;
            else if(d%7==0)cout<<"Wednesday"<<endl;
        }
        if(m==12){
            d=d+334;
            if(d%7==1)cout<<"Thursday"<<endl;
            else if(d%7==2)cout<<"Fridy"<<endl;
            else if(d%7==3)cout<<"Saturday"<<endl;
            else if(d%7==4)cout<<"Sunday"<<endl;
            else if(d%7==5)cout<<"Monday"<<endl;
            else if(d%7==6)cout<<"Tuesday"<<endl;
            else if(d%7==0)cout<<"Wednesday"<<endl;
        }
            }
    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>
using namespace std;

int main(){
  int m,d;
  int M[]={0,31,29,31,30,31,30,31,31,30,31,30,31};

  while(cin>>m>>d){
    if(m==0)break;
    int day=2;
    for(int i=m-1;i>0;i--){
      day+=M[i];
    }
    day+=d;
    if(day%7==0)cout<<"Monday"<<endl;
    if(day%7==1)cout<<"Tuesday"<<endl;
    if(day%7==2)cout<<"Wednesday"<<endl;
    if(day%7==3)cout<<"Thursday"<<endl;
    if(day%7==4)cout<<"Friday"<<endl;
    if(day%7==5)cout<<"Saturday"<<endl;
    if(day%7==6)cout<<"Sunday"<<endl;
  }
  return 0;
}

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

int main(){
  
  int a,b,day;
  int tuki[12];
  string days[7];
  tuki[0]=31,tuki[1]=29,tuki[2]=31,tuki[3]=30;
  tuki[4]=31,tuki[5]=30,tuki[6]=31,tuki[7]=31;
  tuki[8]=30,tuki[9]=31,tuki[10]=30,tuki[11]=31;
  days[0] = "Wednesday";
  days[1] = "Thursday";
  days[2] = "Friday";
  days[3] = "Saturday";
  days[4] = "Sunday";
  days[5] = "Monday";
  days[6] = "Tuesday";

  while(1){
    day=0;
    cin >> a >> b;
    if(a == 0)break;
    for(int i=1;i<a;i++){
      day += tuki[i-1];
    }
    day += b;
    day %= 7;
    cout << days[day] << endl;
  }
  return 0;
}