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,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int const MOD = 1000000007;

int dayOfTheWeek( int y, int m, int d )
{
    if( m < 3 ) {
        y--; m += 12;
    }
    return ( y + y/4 - y/100 + y/400 + ( 13*m + 8 )/5 + d )%7;
}

int main() {
    string dayname[] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
    int m,d;
    while(cin >> m, m) {
        cin >> d;
        cout << dayname[dayOfTheWeek(2004,m,d)] << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int main(){
	int days[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	string youbi[7]={"Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"};
	while(1){
		int m,d,s=0;
		cin >> m >> d;
		if(!m&&!d)	break;
		for(int i=0;i<m-1;i++)	s+=days[i];
		s+=d;
		cout << youbi[(s-1)%7] << endl;
	}
	return 0;
}

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

using namespace std;

string today(int month, int day){
    string today;
    int startMonth=1, startDay=1, total=0;
    
    for(int i=startMonth; i<month; i++){
        switch(i){
            case 4:
            case 6:
            case 9:
            case 11:
                total += 30;
                break;
            
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                total += 31;
                break;
            case 2:
                total += 29;
                break;
        }
    }
    total += day;
    //cout << total%7 << endl;
    
    switch(total%7){
        case 1:
            today = "Thursday";
            break;
        case 2:
            today = "Friday";
            break;
        case 3:
            today = "Saturday";
            break;
        case 4:
            today = "Sunday";
            break;
        case 5:
            today = "Mondday";
            break;
        case 6:
            today = "Tuesday";
            break;
        case 0:
            today = "Wednesday";
            break;
    }
    
    
    return today;
}


int main (int argc, char const* argv[]){
    int month, day, n;
    
    cin >> month >> day;
    while(month!=0 && day!=0){
        
        cout << today(month,day)<< endl;
        cin >> month >> day;
    }
    return 0;
}

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

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

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

    int ans = d;
    for(int i=0; i<m-1; i++) ans += days[i];
    
    cout << week[(ans + 2) % 7] << endl;
  }
}

C++: #include "bits/stdc++.h"
using namespace std;

int main(){
	int m,d;
	int mm[]={31,29,31,30,31,30,31,31,31,31,30,31};
	string s[]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
	while(cin>>m>>d){
		if(m==0)break;
		int dd=0;
		for(int i=0;i<m-1;i++)dd+=mm[i];
		dd+=d;
		int ans=(dd+2)%7;
		//cout<<dd<<endl;
		cout<<s[ans]<<endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int, int>;

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

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

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int m, d;
  while (cin >> m >> d, m) {
    cout << s[zeller(2004, m, d)] << endl;
  }

  return 0;
}

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

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

int mtod(int m){
	if (m==0)return 0;
	int re=0;
	if(m==2)re=29;
	else if(m==4 || m==6||m==9||m==11)re=30;
	else re=31;
	return mtod(m-1)+re;
}
int main(){
	int m,d;
	while(cin>>m>>d && m+d){
		int now=mtod(m-1)+d;
		cout<<day[(now-1)%7]<<endl;
	}
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(){
	int m,d;
	while(true){
	cin>>m>>d;
	if(m==0&&d==0)
		break;
	for(int i=m-1;i>0;i--){
		if(i==1)
			d+=31;
		if(i==2)
			d+=29;
		if(i==3)
			d+=31;
		if(i==4)
			d+=30;
		if(i==5)
			d+=31;
		if(i==6)
			d+=30;
		if(i==7)
			d+=31;
		if(i==8)
			d+=31;
		if(i==9)
			d+=30;
		if(i==10)
			d+=31;
		if(i==11)
			d+=30;
		if(i==12)
			d+=31;
	}
	d=d%7;
	switch(d){
	    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++: //What day is today?
#include<bits/stdc++.h>
using namespace std;

int md[12]={31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

int main(){
  int m, d;
  while(cin >> m >> d){
    int sumd=0;
    if(m==0)break;
    for(int i=0; i<m-1; i++){
      sumd+=md[i];
    }
    sumd+=d;
    switch(sumd%7){
    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;
    case 0 : cout << "Wednesday" << endl; break;
    }
  }
  return 0;
}

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

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

int main() {
    int m, d;
    while (cin >> m >> d, m && d) {
        int t = d + accumulate(day, day + m - 1, 0);
        cout << date[(t + 2) % 7] << endl;
    }
    return 0;
}

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

int main()
{
	std::vector<std::string> day_of_week{
		"Thursday",
		"Friday",
		"Suterday",
		"Sunday",
		"Monday",
		"Tuesday",
		"Wednesday"
	};

	std::vector<int> day_num_of_month{
		31,
		29,
		31,
		30,
		31,
		30,
		31,
		31,
		30,
		31,
		30,
		31
	};

	int month = 0;
	int day = 0;

	while (std::cin >> month >> day)
	{
		if (0 == month) { break; }

		int days_elapsed = 0;
		for (int m = 1; m < month; ++m)
		{
			days_elapsed += day_num_of_month[m - 1];
		}
		days_elapsed += day;

		std::cout << day_of_week[(days_elapsed - 1) % 7] << std::endl;
	}

	return 0;
}

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

int main()
{
	while(1)
	{
		int h=20,y=4,m,d,W,ans;
		char *youbi[7]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
		cin>>m>>d;
		if(m==0)break;
		if(m<3)
		{
			y--;
			m+=12;
		}
		W=(y+y/4-y/100+y/400+(13*m+8)/5+d)%7;
		cout<<youbi[W]<<endl;
	}
	return 0;
}