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>
using namespace std;
int main(){
	int m,d;
	for(;;){
		cin >>m>>d;
		if(m == 0 && d == 0){break;}
		if(m == 2){d+=3;}
		else if(m == 3){d+=4;}
		else if(m == 5){d+=2;}
		else if(m == 6){d+=5;}
		else if(m == 8){d+=3;}
		else if(m == 9){d+=6;}
		else if(m == 10){d+=1;}
		else if(m == 11){d+=4;}
		else if(m == 12){d+=6;}
		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;}
		else if(d%7 == 0){cout <<"Wednesday"<<endl;}
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using lint = long long int;
using ulint = unsigned long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T, class U> void assign(V<T>& v, int n, const U& a) { v.assign(n, a); }
template<class T, class... Args> void assign(V<T>& v, int n, const Args&... args) { v.resize(n); for (auto&& e : v) assign(e, args...); }


int main() {
  cin.tie(nullptr); ios_base::sync_with_stdio(false);
  V<> d{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  V<string> s{"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
  while (true) {
    int x, y; cin >> x >> y, --x, --y;
    if (x == -1) break;
    int a = 0;
    for (int i = 0; i < x; ++i) a += d[i];
    a += y;
    cout << s[(a + 3) % 7] << '\n';
  }
}

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

int search(int a){
	int month;
	if(a==2) month = 29;
	else if(a%2!=0) month = 31;
	else month = 30;
	return month;
}

char *Whatday(int a,int b){
	int month;
	char *day;
	int date=0;
	
	for(int i=1;i<a;i++){
		date = date+search(i);
	}
	date += b;
	switch(date%7){
		case 0: day ="Wednesdayday"; break;
		case 1: day ="Thursday"; break;
		case 2: day ="Friday"; break;
		case 3: day ="Saturday"; break; 
		case 4: day ="Sunday"; break;
		case 5: day ="Monday"; break;
		case 6: day ="Tuesday"; break;
	}
	return day;
}

int main() {
	int m,d;
	while(1){
		cin >> m >> d;
		if(m==0&&d==0) break;
		cout << Whatday(m,d) << endl;
	}
	return 0;
}

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

int zeller(int y, int m, int d)
{
	int h;
	int C = y / 100;
	int Y = y % 100;
	int R = (-2 * C) + (C / 4);
	
	if (m <= 2){
		m += 14;
	}
	
	h = d + (26 * ++m / 10) + Y + (Y / 4) + R;
	h = h % 7 + 7;
	h %= 7;
	return (h);
}

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

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

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

	while(cin>>m>>d,m)
	{
		int mm=0,cnt=0;
		while(1)
		{
			if(mm+1<m)
			{
				cnt+=months[mm++];
				continue;
			}
			cnt+=d;
			break;
		}
		cout<<days[cnt%7]<<endl;
	}
	return 0;
}

C++: #include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
#include<map>
using namespace std;

int main(){
    int mod=1000000007;
    int m,d;
    int p[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
    map<int, string> week;
    week[0]="Monday";
    week[1]="Tuesday";
    week[2]="Wednesday";
    week[3]="Thursday";
    week[4]="Friday";
    week[5]="Saturday";
    week[6]="Sunday";
    for (;;){
        scanf("%d %d",&m,&d);
        if (m==0) break;
        int tmp=3;
        if (m>1) {
            for (int i=1;i<m;i++) {
                tmp=(tmp+p[i])%7;
            }
        }
        cout<<week[(tmp+d-1)%7]<<endl;
    }
    return 0;
}

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

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

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

int main(void){
    int m,d,n;
    while(std::cin>>m>>d){
        if(m==0&&d==0) break;
        n=0;
        int i;
        for(i=1;i<m;i++) n+=monthes[i];
        n+=d;
        std::cout<<day[n%7]<<std::endl;
    }
    return 0;
}

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

int main(void){
  int a, b;
  int m[] = {0, 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335};
  int r = 0;
  while(1){
    cin >> a >> b;
    if(a == 0 && b == 0) break;
    r = (m[a] + b) % 7;
    switch (r)
    {
    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>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <set>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()

int main() {
    int m, d;
    int months[] = {31,29,31,30,31,30,31,31,30,31,30,31};
    while(cin >> m >> d, m + d) {
        REP(i,m-1) {
            d += months[i];
        }
        d -= 1;
        switch (d % 7) {
            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;
                
            default:
                break;
        }
    }
    return 0;
}

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

const int t[14] = {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335};

int main(void) {
	int m, d, a;

	while (cin >> m >> d, m) {
		a = (t[m-1] + d) % 7;
		if (a == 0) cout << "Wednesday";
		else if (a == 1) cout << "Thursday";
		else if (a == 2) cout << "Friday";
		else if (a == 3) cout << "Saturday";
		else if (a == 4) cout << "Sunday";
		else if (a == 5) cout << "Monday";
		else cout << "Tuesday";
		cout << endl;
	}

	return 0;
}

C++: #include<cstdio>

int main(){
	int a[] = {0,0,31,60,91,121,152,182,213,244,274,305,335,366};
	int m, d;
	char day[7][10] = {"Monday", "Tuesday", "Wednesday", "Thursday","Friday","Saturday","Sunday"};
	while(scanf("%d %d", &m, &d) + 1){
		printf("%s\n", day[(a[m] + d + 2) % 7]);
	}
}