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>
#include<string>
using namespace std;
int main(){
  int month,day,bell;
  string s;
  while(1){
    cin >> month >> day;
    if(month==0 && day==0){
      break;
    }
    if(month==1 || month==4 || month==7){
      bell=4;
    }
    else if(month==2 || month==8){
      bell=7;
    }
    else if(month==3 || month==11){
      bell=1;
    }
    else if(month==5){
      bell=6;
    }
    else if(month==6){
      bell=2;
    }
    else if(month==9 || month==12){
      bell=3;
    }
    else if(month==10){
      bell=5;
    }

    for(int i=1;i<day;i++){
      bell++;
      if(bell>=8){
	bell=1;
      }
    }

    if(bell==1){
      s="Monday";
    }
    else if(bell==2){
      s="Tuesday";
    }
    else if(bell==3){
      s="Wednesday";
    }
    else if(bell==4){
      s="Thursday";
    }
    else if(bell==5){
      s="Friday";
    }
    else if(bell==6){
      s="Saturday";
    }
    else if(bell==7){
      s="Sunday";
    }
    cout << s << endl;
  }
  return (0);
}

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

int main() {
	int month, day; cin >> month >> day;
	while (month != 0 && day != 0) {
		if (month >= 1) day = day;
		if (month >= 2) day = day + 31;
		if (month >= 3) day = day + 29;
		if (month >= 4) day = day + 31;
		if (month >= 5) day = day + 30;
		if (month >= 6) day = day + 31;
		if (month >= 7) day = day + 30;
		if (month >= 8) day = day + 31;
		if (month >= 9) day = day + 31;
		if (month >= 10) day = day + 30;
		if (month >= 11) day = day + 31;
		if (month >= 12) day = day + 30;
		if (day % 7 == 0) cout << "Wednesday" << endl;
		if (day % 7 == 1) cout << "Thursday" << endl;
		if (day % 7 == 2) cout << "Friday" << endl;
		if (day % 7 == 3) cout << "Saturday" << endl;
		if (day % 7 == 4) cout << "Sunday" << endl;
		if (day % 7 == 5) cout << "Monday" << endl;
		if (day % 7 == 6) cout << "Tuesday" << endl;
		cin >> month >> day;
	}
	return 0;
}

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

string weekday(int n){
	switch(n){
	case 0:	return "Monday";
	case 1: return "Tuesday";
	case 2: return "Wednesday";
	case 3: return "Thursday";
	case 4: return "Friday";
	case 5: return "Saturday";
	case 6: return "Sunday";
	}
}

int monthdays(int m){
	switch (m){
		case 1:
		case 3:
		case 5:
		case 7:
		case 8:
		case 10:
		case 12:
			return 31;
		case 4:
		case 6:
		case 9:
		case 11:
			return 30;
		case 2:
			return 29;
	}
	return 0;
}

int days(int m, int d){
	int s=0;
	for (int i=1; i<m; i++)
		s += monthdays(i);
	return s+d;
}

int main(void){
	
	while (true){
		int m,d;
		cin>>m>>d;
		if (m==0) break;
		int dif = days(m, d)-1;
		cout<<weekday((dif+3)%7)<<endl;
	}
	return 0;
}

C++: 
//Nayeem Shahriar Joy ,Applied Physics And Electronic Engineering , University of Rajshahi.

 #include<iostream>
#include<string>
#include<algorithm>
#include<vector>

using namespace std;

int dayoftheweek(int d,int m,int y)

{
    int t[]={0,3,2,5,0,3,5,1,4,6,2,4};
    y=y-m<3;
    return (y+y/4-y/100+y/400+t[m-1]+d)%7;
}

int main(){

   int m,d;

   while(cin>>m>>d){

        if(m==0 && d==0)

        {
            break;
        }

   int w = dayoftheweek(d,m,2004);

   if(w==1)

   {
       cout<<"Thursday"<<endl;
   }

   else if(w==2)

   {
       cout<<"Friday"<<endl;
   }

   else if(w==3)

   {
       cout<<"Saturday"<<endl;
   }

   else if(w==4)

   {
       cout<<"Sunday"<<endl;
   }

   else if(w==5)

   {
       cout<<"Monday"<<endl;
   }

   else if(w==6)

   {
       cout<<"Tuesday"<<endl;
   }

   else if(w==7)

   {
       cout<<"Wednesday"<<endl;
   }
   }

    return 0;
}

C++: #include <fstream>
#include <iostream>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;

int main() {
  ifstream cin("../test.txt");

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

  int m, d;
  while (true) {
    cin >> m >> d;
    if (!(m|d)) break;
    int n = first;
    for (int i = 0; i < m-1; i++) {
      n += year[i];
    }
    n += d-1;

    n %= 7;
    cout << day[n] << endl;
  }
}

C++: #include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<string.h>
#include<vector>
#include<math.h>
#include<queue>
#include <algorithm>
#include<functional>
#include<cstdlib>
#include<cmath>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define CI cin >>
#define CO cout <<
#define E << endl;

using namespace std;

typedef pair<int, int> P;
typedef pair<long, long> LP;
typedef pair<int, P> PP;
typedef pair<long, LP> LPP;

int N;

int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };

int day = 0, month = 0;

void input(void) {
	CI month >> day;
	return;
}


int main(void) {
	int weekday = 0;
	int y = 2004;

	string dayname[] = { "Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday" };
	while (true) {
		input();
		if (day == 0) {
			break;
		}
		if (month < 3) {
			y--; month += 12;
		}
		weekday =  (y + (y / 4) - (y / 100) + (y / 400) + (13 * month + 8) / 5 + day) % 7;
		y = 2004;
		CO dayname[weekday] E
	}
	
	return 0;
}

C++: #include<iostream>

using namespace std;

int main()
{
	int month[12];

	month[0]=31;
	month[1]=29;
	month[2]=31;
	month[3]=30;
	month[4]=31;
	month[5]=30;
	month[6]=31;
	month[7]=31;
	month[8]=30;
	month[9]=31;
	month[10]=30;
	month[11]=31;

	int hoge,fuga;

	hoge = 1;

	int i;
	int count=0;

	while(hoge!=0)
	{
		count = 0;
		cin >> hoge >> fuga;
		//cout << count << endl;
		for(i=0;i<hoge-1;i++)
		{
			count+=month[i];
		}	
		//cout << count << endl;

		count+=fuga;

		//cout << count << endl;

		int flag = 0;
	
		flag = count % 7;

		if(flag==0 & hoge!=0)
		{
			cout << "Wednesday" <<endl;
		}
		if(flag==1 & hoge!=0)
		{
			cout << "Thursday" <<endl;
		}
		if(flag==2 & hoge!=0)
		{
			cout << "Friday" <<endl;
		}
		if(flag==3 & hoge!=0)
		{
			cout << "Saturday" <<endl;
		}
		if(flag==4 & hoge!=0)
		{
			cout << "Sunday" <<endl;
		}
		if(flag==5 & hoge!=0)
		{
			cout << "Monday" <<endl;
		}
		if(flag==6 & hoge!=0)
		{
			cout << "Tuesday" <<endl;
		}
	}
}

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

int main() {
	string youbi[7] = {"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
	int month[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
	
	int gathu,nichi;
	while ( cin >> gathu >> nichi,gathu ) {
		int keika = 0;
		for ( int i = 0; i < gathu-1; i++ ) {
			keika += month[i];
		}
		keika += nichi;
		
		cout <<  youbi[keika % 7] << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
 int main()
{
    
    int days[] = {31,29,31,30,31,30,31,31,30,31,30,31};
    string week[7] = {"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
    int month, day;
    while(cin >> month >> day)
    {
         
        int n = 0;
        for(int i=1; i<month; i++)
        {
            n += days[i-1];
        }
        n += day;
  
        n %= 7;
        cout << week[n] <<endl;
    }
  return 0;
}