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;

int main()
{
	int day[] = { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
	for (int i = 1; i < 12; i++) {
		day[i] += day[i - 1];
	}
	int mo, da;
	while (cin >> mo >> da, mo | da) {
		switch ((day[mo - 1] + da - 1) % 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>
#include <string>
using namespace std;
string A[] = { "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday",
"Wednesday" };
int D[] = { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
int main()
{
    int m, d, B[13];
    B[0] = 1;
    for (int i = 1; i <= 12; ++i) B[i] = B[i-1] + D[i];
    while (cin >> m >> d) {
        if (!(m | d)) break;
        int t = B[m-1] + d - 2;
        cout << A[t%7] << endl;
    }
    return 0;
}

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


int zeller(int y , int m , int d){
	if(m==1 || m==2) {m+=12; y-=1;}
	return(y + y/4 - y/100 + y/400 + ((13*m+8)/5) + d )%7;
}

int main(){
	int m , d , w=4 , fw;
	while (cin >> m >> d, m){
		switch(zeller(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;
		}
	}
	return 0; 
}

C++: #include <stdio.h>

int total[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30};

int Sum(int x) {
  int i, sum = 0;
  for(i = 0; i < x; i ++) {
    sum += total[i];
  }

  return sum;
}

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

    switch((Sum(month - 1) + day)%7) {
      case 0:
        printf("Thursday\n");
        break;

      case 1:
        printf("Friday\n");
        break;

      case 2:
        printf("Saturday\n");
        break;

      case 3:
        printf("Sunday\n");
        break;

C++: #include <stdio.h>
int main(){
	char day[][16] = {"Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"};
	int month[12] = {30,28,30,29,30,29,30,30,29,30,29,30};
	int m,d,i,n;
	while(1){
		n=0;
		scanf("%d%d",&m,&d);
		if(!m&&!d) break;
		for(i=0;i<m-1;i++) n += month[i]+1;
		n+=d-1;
		n = n%7;
		printf("%s\n",day[n]);
	}
	return 0;
}

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

int main(){
  int m,d;
  int cnt;
  string days[8]={"\0","Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"};
  while(1){
    cnt = 0;
    cin >> m >> d;
    if(m == 0 && d == 0) break;
    cnt += d;
    for(m--;m>0;m--){
      switch (m){
      case 4:
      case 6:
      case 9:
      case 11:
	cnt += 30;
      case 2:
	cnt += 29;
      default:
	cnt += 31;
      }
    }
    cout << days[cnt%7] << endl;
  }
}

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

int main() {
	int m,d;
	cin >> m >> d;
	
	while(m!=0 && d!=0){
		int days=0;
		days+=d;
		
		if(m==2)days+=31;
		else if(m==3)days+=60;
		else if(m==4)days+=91;
		else if(m==5)days+=121;
		else if(m==6)days+=152;
		else if(m==7)days+=182;
		else if(m==8)days+=213;
		else if(m==9)days+=244;
		else if(m==10)days+=274;
		else if(m==11)days+=305;
		else if(m==12)days+=335;
		
		days %= 7;
		
		switch(days){
		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;
		case 0: cout <<"Wednesday";break;
		
		}
		cout << endl;
		
		cin >> m >> d;
	}
	return 0;
}

C++: #define ll    long long
#define pb    push_back
#define mk    make_pair
#define f     first
#define s     second
#define pii   pair<int, int>
#define fuck  return 0;

#include<bits/stdc++.h>
using namespace std;


int main()
{
   string a[7]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"} ;
   int sum = 0, day[12]={31,29,31,30,31,30,31,31,30,31,30,31};

   int m, d;

   while((cin >>m >>d) && (m!=0 && d!=0))
   {
       for(int i=0; i<=m-2; i++) sum+= day[i];


       sum += d;
       int ans = sum % 7;
       cout <<a[ans] << endl;
     sum=0;
   }
}

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

#define YEAR 2004

using namespace std;

int main() {
	vector<string> week;
	week.push_back("Monday");
	week.push_back("Tuesday");
	week.push_back("Wednesday");
	week.push_back("Thursday");
	week.push_back("Friday");
	week.push_back("Saturday");
	week.push_back("Sunday");
	int month[12] = {31,29,31,30,31,30,31,31,30,31,30,31};

	int m,d;
	int index = 3; //1月1日が木曜日なので

	while(cin>>m>>d){
		if(m==0 || d==0){ break; }
		for(int i=0; i<m; i++){
			for(int j=1; j<=month[i]; j++){
				if(i+1==m and j==d){ break; }
				index++;
				if(index == 7) index=0;
			}
		}
		cout<<week[index]<<endl;
		index = 3;
	}
	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++: 
      case 6:
        printf("Tuesday\n");
        break;
    }
  }

  return 0;
}

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

C++: #include <iostream>

using namespace std;

int main(void){

  int month[13] ={0,31,29,31,30,31,30,31,31,30,31,30,31};
  int m,d;

  while( cin >> m >> d ){
    if( m == d && d == 0 )break;

    int sum = 0;
    for( int i = 1 ; i < m ; i++ ){
      sum += month[i];
    }

    sum += d; 
    sum %= 7;

    switch(sum){
    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;
}