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 monthNum[13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	string dayName[7] = {"Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"};
	int month, day, passDay=0;
	
	while (1) {
		cin >> month; cin >> day;
		if (month == 0) break;
		
		for (int i=0; i<month; i++)
			passDay += monthNum[i];
		passDay += day-1;
		
		cout << dayName[passDay % 7] << endl;
	}
	
	return 0;
}

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

int main()
{
	int month,day;
	int months[] = {31,29,31,30,31,30,31,31,30,31,30,31};
	string days[7] = {"Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wndnessday"};
	while(cin >> month >> day)
	{
		if(month == 0) break;
		else
		{
			int sum = 0;
			for(int i=0;i<month-1;i++)
			{
				sum += months[i];
			}
			sum += day;
			cout << days[sum%7-1] << endl;
		}
	}
	return 0;
}

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

int main() {
  int days[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
  string youbi[7] = {"Monsay","Tuesday","Wednesday","Thursday",
		     "Friday","Saturday","Sunday"};
  while(1) {
    int mon, day;
    cin >> mon >> day;
    if(mon == 0) break;

    int sum = 0;
    for(int i = 0; i < mon-1; i++) {
      sum += days[i];
    }
    sum += day;

    cout << youbi[(sum+2)%7] << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
  int d[]={31,29,31,30,31,30,31,31,30,31,30,31};
  string s[]={"Thursday",
	      "Friday","Saturday","Sunday","Monday","Tuesday","Wednesday",};
  int i,j;
  int a,b;
  cin>>a>>b;
  while(a!=0){
    int o=0;
    for(i=1;i<a;i++) o+=d[i-1];
    o+=b-1;
    //cout << o << endl;
    cout << s[o%7] << endl;
    cin>>a>>b;
  }
  return 0;
}

C++: #include<stdio.h>
 
int main(){
	int m, d, h[11], i;
	h[0] = h[2] = h[4] = h[6] = h[7] = h[9] = 31;
	h[3] = h[5] = h[8] = h[10] = 30;
	h[1] = 29;
	while(scanf("%d %d", &m, &d) != 0){
		if(m == 0 || d == 0) break;
		for(i = 0; i < m - 1; i++) d += h[i];
		if(d % 7 == 1) printf("Thursday\n");
		else if(d % 7 == 2) printf("Friday\n");
		else if(d % 7 == 3) printf("Saturday\n");
		else if(d % 7 == 4) printf("Sunday\n");
		else if(d % 7 == 5) printf("Monday\n");
		else if(d % 7 == 6) printf("Tuesday\n");
		else if(d % 7 == 0) printf("Wednesday\n");
	}
	return 0;
}

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

using namespace std;

int Month;
int Day;

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

int ans[12][31];
int main(int argc, char *argv[])
{
  while(scanf("%d %d",&Month,&Day)){
      int d = 3;
    if(Month == 0)
      break;
    for(int i = 0;i < 12;i++){
      for(int j = 0;j < days[i];j++){
	ans[i][j] = d%7;
	d++;
      }
    }
    cout <<data[ans[Month-1][Day-1]]<<endl;
  }
  return 0;
}

C++: #include <stdio.h>
int main(){
    int tuki,hi,youbi=4;
    while(1){
        scanf("%d %d",&tuki,&hi);
        if(tuki==0) break;
        switch(tuki){
            case 2: youbi=youbi+31+hi-1;
                break;
            case 3: youbi=youbi+60+hi-1;
                break;
            case 4: youbi=youbi+91+hi-1;
                break;
            case 5: youbi=youbi+121+hi-1;
                break;
            case 6: youbi=youbi+152+hi-1;
                break;
            case 7: youbi=youbi+182+hi-1;
                break;
            case 8: youbi=youbi+213+hi-1;
                break;
            case 9: youbi=youbi+244+hi-1;
                break;
            case 10: youbi=youbi+274+hi-1;
                break;
            case 11: youbi=youbi+305+hi-1;
                break;
            case 12: youbi=youbi+335+hi-1;
                break;
        }
        youbi=youbi%7;
        switch(youbi){
            case 0:puts("Sunday");
                break;
            case 1:puts("Monday");
                break;
            case 2:puts("Tuesday");
                break;
            case 3:puts("Wednesday");
                break;
            case 4:puts("Thursday");
                break;
            case 5:puts("Friday");
                break;
            case 6:puts("Saturday");
                break;
        }
        youbi=4;
    }
    return 0;
}

C++: #include <iostream>

int main(){
    int m, d, w = 3;
    int days[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    char *weekName[7] = {"Sunday", "Monday", "Tuesday", "Wednesday",
                         "Thursday", "Friday", "Saturday"};
    while(1){
        std::cin >> m >> d;
        if(!(m || d)){
            return 0;
        }
        for(int i = 1; i < m; i++){
            w += days[i - 1];
        }
        w += d; 
        std::cout << weekName[w % 7] << std::endl;
    }
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

int main() {
	VI day = { 31,29,31,30,31,30,31,31,30,31,30,31 };
	VS name = { "Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday" };
	while (true) {
		int x, y;
		cin >> x >> y;
		if (x == 0 && y == 0)break;

		int sum = 0;
		rep(i, x - 1)sum += day[i];
		sum += y;
		cout << name[(sum - 1) % 7] << endl;
	}
}