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 a,b;
  int day[12] = {0,3,4,0,2,5,0,3,6,1,4,6};
  while(cin >>a>>b,a||b){
    b+=day[a-1];
    switch(b%7){
    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;
    }
  }
}

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 && d == 0) break;

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

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

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

  while(cin >> m >> d, m || d){
    int sum = 0;

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

    cout << week[(sum + 2) % 7] << endl;
  }
}

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

int main(){
  int day30[5] = {3,4,6,9,11};

  while(1) {
  int m,d;
  cin >> m >> d;
  if(m == 0 && d == 0) break;
  int a = 1,b = 1,count = 0;

  while(1) {

    if(a == m && b == d) break;
    
    b++;
    count++;

    if(a == 2 && b == 30) {
      a++;
      b = 1;
    }
    else if(b == 31) {
      for(int i=0;i<5;i++) 
	if(day30[i] == a) {
	  a++;
	  b = 1;
	  break;
	}
    }
    if( b == 32) {
      a++;
      b = 1;
    }
  }
  
  if(count % 7 == 4 ) cout <<"Monday"<<endl;
  else if(count % 7 == 5) cout << "Tuesday"<<endl;
  else if(count % 7 == 6) cout <<"Wednesday"<< endl;
  else if(count % 7 == 0) cout <<"Turseday"<< endl;
  else if(count % 7 ==1) cout << "Friday" << endl;
  else if(count % 7 ==2)cout << "Taturday" << endl;
  else if(count % 7 ==3) cout << "Sunday" << endl;
  
  }

  return 0;
}

C++: #include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

void print(int i){
	if(i==0)cout<<"Monday"<<endl;
	if(i==1)cout<<"Tuesday"<<endl;
	if(i==2)cout<<"Wednesday"<<endl;
	if(i==3)cout<<"Thursday"<<endl;
	if(i==4)cout<<"Friday"<<endl;
	if(i==5)cout<<"Saturday"<<endl;
	if(i==6)cout<<"Sunday"<<endl;
	return;
}

int main(){
	int m,d,num=3;
	int season[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	while(cin>>m>>d,m){
		rep(i,m-1)num+=season[i];
		num+=d-1;
		num%=7;
		print(num);
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
void daysel(int x){
  switch(x % 7){
  case 6:
  cout << "Tuesday"<<endl; break;
  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;
  }
}
void daycal(int month,int day){
  int x;
  switch(month){
  case 1:
  x = day; break;
  case 2:
  x = 31 + day; break;
  case 3:
  x = 60 + day; break;
  case 4:
  x = 91 + day; break;
  case 5:
  x = 121 + day; break;
  case 6:
  x = 152 + day; break;
  case 7:
  x = 182 + day; break;
  case 8:
  x = 213 + day; break;
  case 9: 
  x = 244 + day;break;
  case 10:
  x = 274 + day;break;
  case 11: 
  x = 305 + day; break;
  case 12:
    x = 335 + day; break;
  }
  daysel(x);

    }
int main(){
  int month,day;
  while(cin >> month >> day && !(month == 0 && day ==0)){   
      daycal(month,day);
  }  
  
}

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

using namespace std;

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

int main()
{
	int m,d;
	int day=0;
	while(1){
		scanf("%d %d",&m,&d);
		if(m==0&&d==0)break;
		day=0;
		for(int i=0;i<m-1;i++){
			day+=month[i];
		}
		day+=d;
		string result;
		const int r=day%7;
		switch(r){
			case 0:
			result="Wednesday";
			break;
		case 1:
			result="Thursday";
			break;
		case 2:
			result="Friday";
			break;
		case 3:
			result="Saturday";
			break;
		case 4:
			result="Sunday";
			break;
		case 5:
			result="Monday";
			break;
		case 6:
			result="Tuesday";
			break;
		}
		cout<<result<<"\n";
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main(){

    int year = 2004,month,day;

    while(cin >> month >> day){
    
        if(month == 0){
            return 0;
        }

        if(month == 1 || month==2){
            year--;
            month += 12;
        }
    
        int tmp = (year + year/4 - year/100 + year/400 + (13*month+8)/5 + day)%7;
    
        cout << date[tmp] << endl;
    }
    
    return 0;

}

C++:  
 #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 
 using namespace std;
 
 int month[12]={31,29,31,30,31,30,31,31,30,31,30,31};
  
 int main()
 {
   int m,d;
   int duration=0;
   while(cin>>m>>d)
   {
     if(m==0&&d==0) break;
     else
     {
       if(m==1) duration=d-1;
       else 
       {
         for(int i=0;i<m-1;i++) duration+=month[i];
         duration+=(d-1);     
       }    
       if(duration%7==0) cout<<"Thursday"<<endl;
       else if(duration%7==1) cout<<"Friday"<<endl;
       else if(duration%7==2) cout<<"Saturday"<<endl;
       else if(duration%7==3) cout<<"Sunday"<<endl;
       else if(duration%7==4) cout<<"Monday"<<endl;
       else if(duration%7==5) cout<<"Tuesday"<<endl;
       else cout<<"Wednesday"<<endl;
     }                
   }
   //while(1);     
   return 0;  
 }