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 <bits/stdc++.h>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); i++)

const int month[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30};
int main()
{
  int i, m, d;
  
  while (cin >> m >> d, m){
    int cntdays = 0;
    for (i = 0; i < m; i++) cntdays += month[i];
    switch ((cntdays + d) % 7){
      case 0:
        cout << "Wednesday";
        break;
      case 1:
        cout << "Thursday";
        break;
      case 2:
        cout << "Friday";
        break;
      case 3:
        cout << "Saturday";
        break;
      case 4:
        cout << "Sunday";
        break;
      case 5:
        cout << "Monday";
        break;
      case 6:
        cout << "Tuesday";
        break;
    }
    cout << endl;
  }
}

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

int main() {
	int mth[12]={31,29,30,30,31,30,31,31,30,31,30,31};
	char wks[][16]={"Wedneday","Thursday","Friday","Sutursday","Sunday",
				"Monday","Tuesday"};
	int m,d;
	while(cin>>m>>d,m){
		int days=0;
		for(int i=0;i<m-1;i++) days+=mth[i];
		days+=d; cout<<wks[days%7]<<endl;
	}
}

C++: #include <algorithm>
#include <iostream>
#include <stdio.h>
#include <stack>

using namespace std;

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

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

int main(int argc, char **argv)
{
  vector<string> wday = {"Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", };
  int mond_nr[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,};

  int m, d, yday;
  for (;;) {
    cin >> m >> d;
    if (m == 0 && d == 0)
      break;

    yday = 0;
    for (int i = 0; i < m; i++) {
      yday += mond_nr[i];
    }
    yday += (d - 1);
    cout << wday[yday % 7] << endl;
  }
  return 0;
}

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

int main(){
	int tuki, hi, k = 0;
	int nissuu[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
	string youbi[7] = {"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
	string out[100];
	while(cin >> tuki >> hi){
		if(tuki == 0){
			break;
		}
		int a = 0;
		for(int i = 0; i < tuki-1; i++){
			a = a+nissuu[i];
		}
		a = (a+hi)%7;
		out[k] = youbi[a];
		k++;
	}
	for(int i = 0; i < k; i++){
		cout << out[i] << endl;
	}
}

C++: //曜日を当てる
#include<cstdio>
#include<string>

using namespace std;

int main(void){
	string name[7]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
	int mond[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	int month,day,m,c;
	int i;	//ループカウンタ

	while(1){
		scanf("%d %d",&month,&day);
		if(month==0)break;
		m=1;	//月の始めの一月
		c=3;	//始まりは木曜日
		while(1){
			for(i=1;i<=mond[m-1];i++,c++)
				if(month==m && i==day) break;
			if(month==m && i==day) break;
			m++;
		}
		printf("%s\n",name[c%7].c_str());
	}

	return 0;
}

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

int manth[] = {31,29,31,30,31,31,30,31,31,30,31,30,31};
string date[] = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Suterday"};

int main(){
	int M, D;
	while( cin >> M >> D, M ){
		int d = 3;
		for(int i=0; i<M-1; i++ ){
			d += manth[i];
		}
		d += D;
		d %= 7;
		cout << date[d] << endl;
	}
}

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

main(){
  int m,d;
  int dc,mc;
  string week[7]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
  int month_days[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
  while(cin >> m >> d){
    
    if(m==0 && d == 0)break;
    
    mc=1;
    dc=3;
    while(1){
      
      for(int i=1;i<=month_days[mc];i++,dc++){
	if(m==mc&& d==i)break;
      }
      if(m==mc)break;
      mc++;
    }
    
    cout << week[dc%7]<<endl;
    
    

  }

  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
using namespace std;

int main() {
  int month[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  string day[] = {"Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday"};
  int m, d;
  for(;;) {
    int ans = 0;
    cin >> m >> d;
    if(m == 0 || d == 0) break;
    for(int i=1; i<m; ++i) ans += month[i];
    ans += d;
    cout << day[ans % 7] << endl;
  }
}

C++: #include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int T[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	string S[7]={"Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"};
	while(true){
		int M=in(),D=in();
		if(M==0) break;
		int H=0;
		REP(i,M-1){
			H += T[i];
		}
		H+=D-1;
		H%=7;
		out(S[H]);
	}
	return 0;
}

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;
		}
	}
}