Go: package main

import "fmt"

func main() {
	days := [12]int{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
	weekday := [7]string{"Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday"}

	for {
		var m, d int
		fmt.Scan(&m, &d)
		if m == 0 {
			break
		}

		for i := 0; i < m-1; i++ {
			d += days[i]
		}

		fmt.Println(weekday[d%7])
	}
}

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

int main(int argc, char *argv[]) {
	const int start_day = 3;
	const int days[12] = {
		31, 29, 31, 30, 31, 30,
		31, 31, 30, 31, 30, 31
	};
	const std::string week[] = {
		"Monday", "Tuesday", "Wednesday", "Thursday",
		"Friday", "Saturday", "Sunday"
	};
	
	while (true) {
		int month, day, sum = start_day;
		fscanf(stdin, "%d %d", &month, &day);
		if (month == 0) {
			break;
		}
		sum += day-1;
		for (int i = 0; i < month-1; i++) {
			sum += days[i];
		}
		printf("%s\n", week[sum%7].c_str());
		
	}
	return 0;
}

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

double r(double x1,double y1,double x2,double y2){
	return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
	
	}

int main() {
	// your code goes here
int a[13];
a[1]=31;
a[2]=29;
a[3]=31;
a[4]=30;
a[5]=31;
a[6]=30;
a[7]=31;
a[8]=31;
a[9]=30;
a[10]=31;
a[11]=30;
a[12]=31;

int m,d,z,y;
cin>>m>>d;
while(m!=0){
	if(m==0) z=d;
	else{
		z=d;
		for(int i=1;i<m;i++){
			z=z+a[i];
		}
	}
	y=z%7;
	if(y==1){
		cout<<"Thursday"<<endl;
	}
		if(y==2){
		cout<<"Friday"<<endl;
	}
		if(y==3){
		cout<<"Saturday"<<endl;
	}
		if(y==4){
		cout<<"Sunday"<<endl;
	}
		if(y==5){
		cout<<"Monday"<<endl;
	}
		if(y==6){
		cout<<"Tuesday"<<endl;
	}
		if(y==0){
		cout<<"Wednesday"<<endl;
	}
	
	cin>>m>>d;
}
	
	return 0;
}

C++: #include <stdio.h>

int zeller(int y, int m, int d){
	if(m <= 2){
		y--;
		m += 12;
	}

	int J = (int)(y/100);
	int K = y - (int)(y/100)*100;

	return (d + (int)((m+1)*26/10) + K + (int)(K/4) + (int)(J/4) + 5 * J + 5) % 7;
}

int main(void){
	int y, m, d;
	y = 2004;
	char *wday[7] = {
		"Monday",
		"Tuesday",
		"Wednesday",
		"Thursday",
		"Friday",
		"Saturday",
		"Sunday",
	};
	while(true){
		scanf("%d %d", &m, &d);
		if(m == 0){ break; }
		int w = zeller(y, m , d);
		puts(wday[w]);
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(void){
	int m,d;
	string day[7]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday",};
	int box[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	int sum;
	int h;
	while(1){
		cin>>m>>d;
		if(m==0&&d==0)	break;
		sum=d;
		for(int i=0;i<m-1;i++){
			//cout<<i<<endl;
			sum+=box[i];
		}
		//cout<<sum<<endl;
		h=sum%7;
		cout<<day[h]<<endl;
	}
	return 0;
}

C++: #include <stdio.h>

static const char *days[7]=
{
    "Sunday",
    "Monday",
    "Tuesday",
    "Wednesday",
    "Thursday",
    "Friday",
    "Saturday",
    
};

int main(void)
{
    int base=4;
    int monthbase[12]=
    {0,3,4,0,2,5,0,3,6,1,4,6,};
    while(1)
    {
        int m,d;
        scanf("%d%d",&m,&d);
        if(m==0)
            break;
        puts(days[(base+monthbase[m-1]+d-1)%7]);
    }
    return 0;
}

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

using namespace std;

int min(){
	string y[7] = {"Wednesday", "Thrsday", "Frinday", "Saturday", "Sunday", "Monday", "Tuesday"};
	int mon[13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

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

		while(m != 0){
			d = d + mon[m-1];
		}
		cout << y[d%7] <<endl;
	}
}

C++: #include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<string>

using namespace std;

int main()
{
  int days[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

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

  return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e8;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
int main(){
	string s[]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
	int d[]={31,29,31,30,31,30,31,31,30,31,30,31};
	int a,b;
	while(cin>>a>>b,a+b){
		int co=b;
		a--;
		while(a){a--;co+=d[a];}
		cout<<s[co%7]<<endl;
	}
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <set>

using namespace std;

int main()
{
	while (1)
	{
		int a = 0;
		int b = 0;
		cin >> a;
		cin >> b;
		if (a == 0)break;
		if (a == 2)b += 31;
		if (a == 3)b += 31 + 29;
		if (a == 4)b += 60 + 31;
		if (a == 5)b += 91 + 30;
		if (a == 6)b += 121 + 31;
		if (a == 7)b += 152 + 30;
		if (a == 8)b += 182 + 31;
		if (a == 9)b += 213 + 31;
		if (a == 10)b += 30 + 244;
		if (a == 11)b += 31 + 274;
		if (a == 12)b += 30 + 305;
		if (b % 7 == 1)cout << "Thursday" << endl;
		if (b % 7 == 1)cout << "Friday" << endl;
		if (b % 7 == 1)cout << "Saturday" << endl;
		if (b % 7 == 1)cout << "Sunday" << endl;
		if (b % 7 == 1)cout << "Monday" << endl;
		if (b % 7 == 1)cout << "Tuesday" << endl;
		if (b % 7 == 1)cout << "Wednesday" << endl;
	}

	return 0;
}

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

int main(){
	int m,d;
	while(cin >> m >> d){
		if(m == 0 && d == 0)break;
		int n = 0;
		for(int i = 1; i < m; i++){
			if(i == 2)n += 29;
			else if(i == 4 || i == 6 || i == 9 || i == 11)n += 30;
			else n += 31;
		}
		n += d;
		switch(n % 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>
using namespace std;

int main()
{
	int monthday[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	const char *weekday[7] = {"Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"};
	
	int month, day;
	
	while(cin >> month >> day, month)
	{
		if(month == 0) break;
		
		int w = day - 1;
		for(int i = 1; i < month; i++)
		    w += monthday[i];
		cout << weekday[w % 7] << endl;
	}
	return 0;
}