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<iostream>
#include<string>
#include<vector>
//#include <bits/stdc++.h>
using namespace std;

int main() {
	int x, y, t;
	vector<int> X, Y, T;
	while (cin >> x >> y) {
		if (x == 0)break;
		X.push_back(x);
		Y.push_back(y);
	}
	for (int i = 0; i < X.size(); i++) {
		if (X[i] == 1)t = (Y[i] - 1) % 7;
		else if (X[i] == 2)t = (30 + Y[i]) % 7;
		else if (X[i] % 2 == 0) {
			if (X[i] >= 8)t = (((X[i] - 8) / 2) * 61 + Y[i] + 212) % 7;
			else t = (((X[i] - 4) / 2) * 61 + 90 + Y[i]) % 7;
		}
		else {
			if(X[i]>=8)t = (((X[i] - 9) / 2) * 61 + 243 + Y[i]) % 7;
			else t= (((X[i] - 3) / 2) * 61 + 59 + Y[i]) % 7;
		}
		T.push_back(t);
	}
	for (int i = 0; i < T.size(); i++) {
		if (T[i] == 0)cout << "Thursday" << endl;
		else if (T[i] == 1)cout << "Friday" << endl;
		else if (T[i] == 2)cout << "Saturday" << endl;
		else if (T[i] == 3)cout << "Sunday" << endl;
		else if (T[i] == 4)cout << "Monday" << endl;
		else if (T[i] == 5)cout << "Tuesday" << endl;
		else cout << "Wednesday" << endl;
	}
	return 0;
}

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

int main()
{
	int day[365];
	int month[12] = {0,31,60,91,121,152,182,212,243,273,304,334};
	int m,d;
	
	for(int i=0;i<365;++i)
		day[i] = i%7;
	
	while(cin >> m >> d){
		if(!m)
			break;

		switch(day[month[m-1] + d-1]){
		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;
		}

	}
	return 0;
}

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

int Zeller(int month,int day){
	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;
}

int main(){

	int month,day;
	while(true){
		scanf("%d %d",&month,&day);
		if(month == 0)break;

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

	}

    return 0;
}

C++: //31,29,31,30,31,30,31,31,30,31,30,31//
#include <iostream>
using namespace std;
int main(){
    int d,m;
    while(cin>>m>>d){
        if(m==0)break;
        if(m==1)d=d%7;
        else if(m==2)d=(d+31)%7;
        else if(m==3)d=(d+60)%7;
        else if(m==4)d=(d+91)%7;
        else if(m==5)d=(d+121)%7;
        else if(m==6)d=(d+152)%7;
        else if(m==7)d=(d+182)%7;
        else if(m==8)d=(d+213)%7;
        else if(m==9)d=(d+244)%7;
        else if(m==10)d=(d+274)%7;
        else if(m==11)d=(d+305)%7;
        else if(m==12)d=(d+335)%7;
            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 cout<<"Wednesday"<<endl;
        
        }
    return 0;
}

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

int Zellers_congruence(int y, int m, int d) {
	int num;
	if (m < 3)num= (y - 1) + (y - 1) / 4 - (y - 1) / 100 + (y - 1) / 400 + (13 * (m + 12) + 8) / 5 + d;
	else num= y + y / 4 + -y / 100 + y / 400 + (13 * m + 8) / 5 + d;
	return num % 7;
}
//?????§???????????¬??????year+year/4-year/100+year/400+(13*month+8)/5+day
//1??? or 2 ??????????????????????????´???????????????????????¨??????????¨?????????????

int main() {
	int  m, d;
	while (true) {
		cin >> m >> d;
		if (m == 0 && d == 0)break;
		switch (Zellers_congruence(2004, m, d)) {
		case 0:cout << "Sunday" << endl; break;
		case 1:cout << "Monday" << endl; break;
		case 2:cout << "Tuesday" << endl; break;
		case 3:cout << "Wednesday" << endl; break;
		case 4:cout << "Thursday" << endl; break;
		case 5:cout << "Friday" << endl; break;
		case 6:cout << "Saturday" << endl; break;
		default:cout << "error" << endl; break;
		}
	}
	return 0;
}

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

int main(){

  int m, d, cnt;
  int p[12] = {31, 29, 31, 30, 31, 30,
               31, 31, 30, 31, 30, 31};
  string str[7] = {"Monday", "Tuesday", "Wednesday",
                   "Thursday", "Friday", "Saturday",
                   "Sunday"};
  
  p[0] = 3;
  for(int i=1; i<12; i++){
    p[i] = (p[i-1] + p[i-1]) % 7;
  }

  while(1){
    cin >> m >> d;
    if(m == 0 && d == 0){
      break;
    }
    cout << str[(p[m-1] + d - 1) % 7] << endl;
  }

  return 0;

}

C++: #include<iostream>
using namespace std;
int n,m,cnt,i,j;
string str[7]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
int t[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
int main(){
  while(cin>>n>>m&&n&&m){
    cnt=3;
    for(i=1;i<=12;i++){
      for(j=1;j<=t[i];j++){
	if(i==n&&j==m)break;
	cnt++;
      }
      if(i==n&&j==m)break;
    }
    //cout<<cnt<<endl;
    cout<<str[cnt%7]<<endl;
  }
  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<<"Tuseday"<<endl;
		else if(!ans) cout<<"Wednsday"<<endl;
	}
}

C++: #include<stdio.h>
#include<windows.h>

void y(int x ){
	if(x == 0)
		puts("Thursday");
	else if(x == 1)
		puts("Friday");
	else if(x == 2)
		puts("Saturday");
	else if(x == 3)
		puts("Sunday");
	else if(x == 4)
		puts("Monday");
	else if(x == 5)
		puts("Tuesday");
	else if(x == 6)
		puts("Wednesday");
}

int main(void){
	int M,D;
	while(1){
		int date = 0,ans;
		int m[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
		
		scanf("%d%d", &M, &D);
		if(M == 0 && D  == 0)break;
		for(int i = 1; i <= 12 ; i++){
			for(int j = 1; j <= m[i-1]; j++){
				if(i == M && j == D){
					ans = date;
				}
				printf("%d%dú%d\n",i,j,date%7);
	//			y(date%7);
				date++;
			}
			Sleep(1000);
		}
		y(ans%7);
	}
	
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(void)
{
  int m, d;
  
  while(1) {
    cin >> m >> d;
    if(m == 0) break;
    
    for(int i = m ; i > 1 ; i--) {
      if(i-1 == 4 || i-1 == 6 || i-1 == 9 || i-1 == 11) d += 30;
      else if(i-1 == 2) d += 29;
      else if(i-1 == 1 || i-1 == 3 || i-1 == 5 || i-1 == 7 || i-1 == 8 || i-1 == 10) d += 31;
    }
    
    if(d % 7 == 1) cout << "Thursday" << endl;
    if(d % 7 == 2) cout << "Friday" << endl;
    if(d % 7 == 3) cout << "Saturday" << endl;
    if(d % 7 == 4) cout << "Sunday" << endl;
    if(d % 7 == 5) cout << "Monday" << endl;
    if(d % 7 == 6) cout << "Tuesday" << endl;
    if(d % 7 == 7) cout << "Wednesday" << endl;
  }
  return 0;
}