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++: #define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>

typedef long long ll;
using namespace std;

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

	int a,b;
	while(~scanf("%d %d",&a,&b)){
		if(a==0 && b==0) break;

		int passed=0;
		for(int i=0;i<a - 1;i++){
			passed += days[i];
		}

		passed += b;
		cout << week[(passed - 1) % 7] << endl;
	}
}

C++: #include<iostream>
using namespace std;
int main(){
	int m,d,n=0,date[50]={0},i=0;
	while(cin>>m&&m!=0){
		cin>>d;
		switch(m){
			case 1:
				break;
			case 2:
				d=d+3;
				break;
			case 3:
				d=d+4;
				break;
			case 4:
				d=d+3;
				break;
			case 5:
				d=d+6;
				break;
			case 6:
				d=d+1;
				break;
			case 7:
				d=d+4;
				break;
			case 8:
				break;
			case 9:
				d=d+2;
				break;
			case 10:
				d=d+5;
				break;
			case 11:
				break;
			case 12:
				d=d+3;
				break;
		}
		date[i]=d%7;
		i++;
		n++;
	}
	for(int i=0;i<n;i++){
		switch(date[i]){
			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 <stdio.h>
#include <string>
#include <iostream>
using namespace std;

int main()
{
  int m,d;

  string week[7] = {"Thursday", "Friday", "Saturday", "Sunday","Mondy", "Tuesday", "Wednesday"};
  int month[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  scanf("%d %d", &m, &d);
  while (m != 0) {
    int day = 0;
    for (int i = 0; i < (m - 1); i++) {
      day += month[i];
    }
    day += d;
 
    cout << week[(day%7)-1] << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){
	int m,d;
	int data[]={0,31,29,31,30,31,30,31,31,30,31,30,31};
	cin>>m>>d;
	for(int i=1;i<=m;i++){
        d+=data[i-1];
	}
	switch(d%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;
    }









	return 0;
}

C++: #include <iostream>

using namespace std;
int days[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

void solve()
{
	int month, day;
	while(cin >> month >> day)
	{
		if(!month && !day)
		{
			break;
		}
		int sum = 0;
		for(int i = 0; i < month - 1; ++i)
		{
			sum += days[i];
		}
		sum += day - 1;
		sum %= 7;
		switch(sum)
		{
		case 0: cout << "Thursday"  << endl; break;
		case 1: cout << "Friday"    << endl; break;
		case 2: cout << "Saturday"  << endl; break;
		case 3: cout << "Sunday"    << endl; break;
		case 4: cout << "Monday"    << endl; break;
		case 5: cout << "Tuesday"   << endl; break;
		case 6: cout << "Wednesday" << endl; break;
		}
	}
}

int main()
{
	solve();
	return(0);
}

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


using namespace std;
#define LENGTH 10

void printDay(int num){
  switch(num){
  case 0:
    cout << "Monday" << endl;
    break;
  case 1:
    cout << "Tuesday" << endl;
    break;
  case 2:
    cout << "Wednesday" << endl;
    break;
  case 3:
    cout << "Thursday" << endl;
    break;
  case 4:
    cout << "Friday" << endl;
    break;
  case 5:
    cout << "Saturday" << endl;
    break;
  case 6:
    cout << "Sunday" << endl;
    break;
  }
}
    
    

int main(){
  int month, day;
  int days[12]={31,29,31,30,31,30,31,31,30,31,30,31};
  while(cin >> month >> day){
    int d=3;
      if(month==0){
      break;
    }

    for(int i=0;i<month-1;i++){
      d+=days[i];
      d = d%7;
    }

    for(int i=1;i<day;i++){
      d+=1;
      d = d%7;
    }
    printDay(d);
  }
}

C++: 
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <utility>
#include <complex>
#include <stack>
#include <climits>

using namespace std;

double sq(double x){return x*x;}

int t[] = {
	0,
	31,
	29,
	31,
	30,
	31,
	30,
	31,
	31,
	30,
	31,
	30,
	31
};

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

int main(){
	for (int i = 0; i < 12; i++)
	{
		t[i+1] += t[i];
	}
	int m,d;
	while(~scanf("%d %d",&m,&d),(m||d)){
		int x = t[m-1] + d + 2;
		cout << b[x % 7] << endl;
	}

	return 0;
}

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 month,day,total,weekday;
  while(cin >> month >> day) {
    if((month == 0)&&(day == 0)) break;
    total = 0;
    for(int i=1;i < month + 1;i++) {
      if(i == month) {
        total += day;
      }
      else if(i != month) {
        if((i == 1)||(i == 3)||(i == 5)||(i == 7)||(i == 8)||(i == 10)||(i == 12))
          total += 31;
        else if((i == 4)||(i == 6)||(i == 9)||(i == 11))
          total += 30;
        else if(i == 2)
          total += 29;
      }
    }
    weekday = total % 7;
    if(weekday == 0)
      cout << "Wednesday" << endl;
    else if(weekday == 1)
      cout << "Thursday" << endl;
    else if(weekday == 2)
      cout << "Friday" << endl;
    else if(weekday == 3)
      cout << "Saturday" << endl;
    else if(weekday == 4)
      cout << "Sunday" << endl;
    else if(weekday == 5)
      cout << "Monday" << endl;
    else if(weekday == 6)
      cout << "Tuesday" << endl;
  }
}

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

using namespace std;

int Month;
int Day;

char *data[] ={
 "Monday",
 "Tuesday",
 "Wednesday",
 "Thursday",
 "Friday",
 "Saturday",
 "Sunday"
};
int days[12] = {31,29,31,30,31,30,31,31,30,31,30,31};

int ans[12][31];
int d = 3;
int main()
{   
    for(int i = 0;i < 12;i++){
      for(int j = 0;j < days[i];j++){
	ans[i][j] = d%7;
	d++;
      }
    }
    while(cin >>Month>>Day){
      if(Month ==0)
	break;
    cout <<data[ans[Month-1][Day-1]]<<endl;
    }
  return 0;
}

C++: #include <iostream>
using namespace std;
int day[]={0,31,29,31,30,31,30,31,31,30,31,30,31};
int main()
{
	int m,d;
	while(cin>>m>>d){
		if(!m)break;
		for(int i=1;i<m;i++)d+=day[i];
		if(d%7==0)cout<<"Wednesday"<<endl;
		else if(d%7==1)cout<<"Thursday"<<endl;
		else if(d%7==2)cout<<"Friday"<<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;
	}
    return 0;
}