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 months[12] = { 31 , 29 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 } ;

	int getmonth , getday ;

	while( cin >> getmonth >> getday )
	{
		if( getmonth == 0 ){ break ; }

		getmonth -- ;
		while( getmonth > 0 )
		{
			getday += months[getmonth-1] ;
			getmonth -- ;
		}

		if( getday %7 == 0 )
		{
			cout << "Wednesday" << endl ;
		}
		else if( getday %7 == 1 )
		{
			cout << "Thursday" << endl ;
		}
		else if( getday %7 == 2 )
		{
			cout << "Friday" << endl ;
		}
		else if( getday %7 == 3 )
		{
			cout << "Saturday" << endl ;
		}
		else if( getday %7 == 4 )
		{
			cout << "Sunday" << endl ;
		}
		else if( getday %7 == 5 )
		{
			cout << "Monday" << endl ;
		}
		else if( getday %7 == 6 )
		{
			cout << "Tuesday" << 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",
    "Friday",
    "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 <stdio.h>

int main()
{
	int month, day, n;
	int md[12] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30,  31, 30};

	while (1) {
		scanf("%d %d", &month, &day);

		if (month == 0) break;
		n = 0;

		for (int i = 0; i < month; i++) {
			n += md[i];
		}
		n += day;

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

	return 0;
}

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

int main(){
	int m,d,ans,i,tmp = 0;
	while(cin>>m>>d,m != 0){
		ans = 0;
		tmp = 0;
		for(i = m-1;i != 0;i--){
			switch(i){
				case 1:
				case 3:
				case 5:
				case 7:
				case 8:
				case 10:
			{
				tmp += 31;
				break;
			}
				case 4:
				case 6:
				case 9:
				case 11:
			{
				tmp += 30;
				break;
			}
				case 2:
			{
				tmp += 29;
				break;
			}
			}
		}
		cout<<tmp<<endl;
		tmp += d;
		ans = tmp % 7;
		switch(ans){
			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>
using namespace std;

int main(){
  int m,d;
  int cnt;
  string days[7]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
  while(1){
    cnt = 0;
    cin >> m >> d;
    if(m == 0 && d == 0) break;
    cnt += d;
    for(m--;m>0;m--){
      switch (m){
      case 4:
      case 6:
      case 9:
      case 11:
	cnt += 30;
	break;
      case 2:
	cnt += 29;
	break;
      default:
	cnt += 31;
	break;
      }
    }
    cout << days[cnt%7] << endl;
  }
}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <math.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const long double EPS = 1e-12;
const LL INF = 1e18;

int month[]={0,31,29,31,30,31,30,31,31,30,31,30,31};
string yobi[]={"Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"};
int main(){
	int mm,dd;
	while(cin>>mm>>dd){
		if(mm==0&&dd==0)break;
		int day=0;
		for(int i=1;i<=12;i++){
			if(mm==i){
				day+=dd-1;
				break;
			}
			day+=month[i];
		}
		cout<<yobi[day%7]<<endl;
	}
	return 0;
}
/*

*/

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


int main(){

	int m,d,n,J,K;
	J=20;
	K=4;
	
	
	while (1) {
		cin>>m>>d;
		if (m==0) break;
		if (m==1||m==2) 
			n=(d+((m+12+1)*26)/10+(K-1)+(K-1)/4+J/4+5*J) %7;
		else
			n=(d+((m+1)*26)/10+K+K/4+J/4+5*J) %7;
		
		switch (n) {
			case 0:
				cout << "Saturday" <<endl;
				break;
			case 1:
				cout << "Sunday" <<endl;
				break;
			case 2:
				cout << "Monday" <<endl;
				break;
			case 3:
				cout << "Tuesday" <<endl;
				break;
			case 4:
				cout << "Wednesday" <<endl;
				break;
			case 5:
				cout << "Thursday" <<endl;
				break;
			case 6:
				cout << "Friday" <<endl;
				break;
			default :
				break;
		}
		
	}
		
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <string>
#include <queue>
#include <algorithm>
#include <cctype>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const double pi=acos(-1);

int x,y,tu[11]={31,29,31,30,31,30,31,31,30,31,30};

int main(){
	while(1){
		cin>>x>>y;
		if(!x&&!y) break;
		int num=0;
		for(int i=0;i<x-1;i++) num+=tu[i];
		num+=y;
		int ans=num%7;
		if(ans==1) cout<<"Thursday"<<endl;
		else if(ans==2) cout<<"Friday"<<endl;
		else if(ans==3) cout<<"Saturday"<<endl;
		else if(ans==4) cout<<"Sunday"<<endl;
		else if(ans==5) cout<<"Monday"<<endl;
		else if(ans==6) cout<<"Tuesday"<<endl;
		else if(!ans) cout<<"Wednesday"<<endl;
	}
}