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(void){

    string day[7] = {"Saturday","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday"};
    //int month[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
    int x,y;

    while(1){
        cin >> x >> y;
        int h = 20;
        int n = 4;
        if(x == 0){
            break;
        }
        if(x == 1 || x == 2){
            n--;
            x+=12;
        }
                       
        int w = n + n/4 + h/4 - 2*h + 13*(x+1)/5 + y;
        //cout << w << endl;
       
        //cout << w%7 << endl;

        string ans = day[w%7];

        cout << ans << endl;
    }
    return 0;
}

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+335;
        }
        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 <iostream>

using namespace std;

int main()
{
	int monthNum[12] = {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-1; i++)
			passDay += monthNum[i];
		passDay += day-1;
		
		cout << dayName[passDay % 7] << endl;
	}
	
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>

typedef long long ll;
using namespace std;

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

	int a,b;
	while(~scanf("%d %d",&a,&b)){
		if(a==0 && b==0) break;

		int passed=0;
		for(int i=0;i<a - 1;i++){
			passed += days[i];
		}

		passed += b;
		cout << week[(passed - 1) % 7] << endl;
	}
}

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

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

int main()
{
  int m,d;

  string week[7] = {"Thursday", "Friday", "Saturday", "Sunday","Mondy", "Tuesday", "Wednesday"};
  int month[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  scanf("%d %d", &m, &d);
  while (m != 0) {
    int day = 0;
    for (int i = 0; i < (m - 1); i++) {
      day += month[i];
    }
    day += d;
 
    cout << week[(day%7)-1] << endl;
  }
  return 0;
}

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

using namespace std;
int days[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

void solve()
{
	int month, day;
	while(cin >> month >> day)
	{
		if(!month && !day)
		{
			break;
		}
		int sum = 0;
		for(int i = 0; i < month - 1; ++i)
		{
			sum += days[i];
		}
		sum += day - 1;
		sum %= 7;
		switch(sum)
		{
		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;
		}
	}
}

int main()
{
	solve();
	return(0);
}

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


using namespace std;
#define LENGTH 10

void printDay(int num){
  switch(num){
  case 0:
    cout << "Monday" << endl;
    break;
  case 1:
    cout << "Tuesday" << endl;
    break;
  case 2:
    cout << "Wednesday" << endl;
    break;
  case 3:
    cout << "Thursday" << endl;
    break;
  case 4:
    cout << "Friday" << endl;
    break;
  case 5:
    cout << "Saturday" << endl;
    break;
  case 6:
    cout << "Sunday" << endl;
    break;
  }
}
    
    

int main(){
  int month, day;
  int days[12]={31,29,31,30,31,30,31,31,30,31,30,31};
  while(cin >> month >> day){
    int d=3;
      if(month==0){
      break;
    }

    for(int i=0;i<month-1;i++){
      d+=days[i];
      d = d%7;
    }

    for(int i=1;i<day;i++){
      d+=1;
      d = d%7;
    }
    printDay(d);
  }
}

C++: 
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <utility>
#include <complex>
#include <stack>
#include <climits>

using namespace std;

double sq(double x){return x*x;}

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

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

int main(){
	for (int i = 0; i < 12; i++)
	{
		t[i+1] += t[i];
	}
	int m,d;
	while(~scanf("%d %d",&m,&d),(m||d)){
		int x = t[m-1] + d + 2;
		cout << b[x % 7] << endl;
	}

	return 0;
}

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

int m,d;
int data[] = {31,29,31,30,31,30,31,31,30,31,30,31};
string day[] = {"Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"};

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

		for(int i = 0; i < m - 1; i++){
			d+=data[m];
		}
		cout << day[d%7-1] << endl;
	}
}