Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func zeller(month, day int) int {
	year := 2004
	if month == 1 || month == 2 {
		year--
		month += 12
	}
	return (year + year/4 - year/100 + year/400 + (13*month+8)/5 + day)%7
}

func main() {
	scanner.Split(bufio.ScanWords)
	for {
		month := nextInt()
		day := nextInt()
		if month == 0 && day == 0{
			break
		}
		switch zeller(month, day) {
		case 0:
			fmt.Println("Sunday")
		case 1:
			fmt.Println("Monday")
		case 2:
			fmt.Println("Tuesday")
		case 3:
			fmt.Println("Wednesday")
		case 4:
			fmt.Println("Thursday")
		case 5:
			fmt.Println("Friday")
		case 6:
			fmt.Println("Saturday")
		}
	}
}

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

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

C++: //曜日を当てる
#include<cstdio>
#include<string>

using namespace std;

int main(void){
	string name[7]={"Mondey","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
	int mond[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	int month,day,m,c;
	int i;	//ループカウンタ

	while(1){
		scanf("%d %d",&month,&day);
		if(month==0)break;
		m=1;	//月の始めの一月
		c=3;	//始まりは木曜日
		while(1){
			for(i=1;i<=mond[m-1];i++,c++)
				if(month==m && i==day) break;
			if(month==m && i==day) break;
			m++;
		}
		printf("%s\n",name[c%7].c_str());
	}

	return 0;
}

C++: #include <cstdio>

using namespace std;

bool testcase_ends() {
    int m, d;
    scanf("%d %d", &m, &d);

    if (m == 0 && d == 0)
        return 1;

    int offset[]={
        0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335
    };

    const char *day[]={
        "Mon", "Tues", "Wednes", "Thurs", "Fri", "Sat", "Sun"
    };

    printf("%sday\n", day[(offset[m-1]+d+2)%7]);
    return 0;
}

int main() {
    int solved=0;
    while (!testcase_ends())
        ++solved;

    return !solved;
}

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-1)%7] << endl;
	}
}

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,x,n) for(int i=(x);i<(n);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define ub upper_bound
#define lb lower_bound
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;

signed main(){
  int M[13]={0,31,60,91,121,152,182,213,244,274,305,335,366};
  string S[7]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
  int m,d;
  while(cin>>m>>d,m){
    int index=M[m-1]+d;
    cout<<S[index%7]<<endl;
  }
  return 0;
}

C++: #include<stdio.h>
int main()
{
int p[12]={31,29,31,30,31,30,31,31,30,31,30,31};
int M,D,sum;
while(1)
{
sum=0;
scanf("%d",&M);
scanf("%d",&D);if(M==0)break;
if(M==0)break;
for(int i=0;i<M-1;i++)
sum+=p[i];

sum+=D;

switch(sum%7)
{
case 4:
printf("Sunday\n");break;
case 5:
printf("Monday\n");break;

case 6:
printf("Tuesday\n");break;

case 0:
printf("Wednesday\n");break;

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

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

case 3:
printf("Saturday\n");break;
}
}
return 0;
}

C++: #include<iostream>

using namespace std;

int mouth[]={-1,31,29,31,30,31,30,31,31,30,31,30,31};

int main(void){

	int mo,da,wa;

	while(1){
		wa=0;
		cin>>mo>>da;
		if(mo==0||da==0) break;
		for(int i=1;i<mo;i++) wa+=mouth[i];
		wa+=da;
		switch(wa%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>

using namespace std;

void count_num(int a,int b){
    string WDay[7] = {"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
    int len[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
    int count = 0;
    for(int i = 0; i< a-1;i++){
        count += len[i];
    }
    count += b;
    cout << WDay[(count+2) % 7] << endl;
}

int main() {
    int a,b;
    while(cin >> a >>  b , a){
        count_num(a,b);
    }
    return 0;
}

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

const string day[] = {"Thurs", "Fri", "Satur", "Sun", "Mon", "Tues", "Wednes"};

int main(){
  int m, d;
  while(cin >> m >> d) {
    int days = d - 1;
    for(int i = 1; i < m; i++) { 
    if(i == 1 || i == 3 || i == 5 || i == 7 || i == 8 || i == 10 || i == 12)
      days += 31;
    else if(i == 4 || i == 6 || i == 9 || i == 11)
      days += 30;
    else
      days += 29;
    }
    cout << day[days % 7] << "day" << endl;
  }
}

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,fuge;

	cin >> hoge >> fuga;

	int i;
	int count=0;

	if(hoge!=0)
	{
		for(i=0;i<hoge-1;i++)
		{
			count+=month[i];
		}	
		
		count+=fuga;
	
		flag = count % 7;
		if(flag==0)
		{
			cout << "Wednesday" <<endl;
		}
		if(fkag==1)
		{
			cout << "Thursday" <<endl;
		}
		if(fkag==2)
		{
			cout << "Friday" <<endl;
		}
		if(fkag==3)
		{
			cout << "Saturday" <<endl;
		}
		if(fkag==4)
		{
			cout << "Sunday" <<endl;
		}
		if(fkag==5)
		{
			cout << "Monday" <<endl;
		}
		if(fkag==6)
		{
			cout << "Tuesday" <<endl;
		}
	}
}

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

using namespace std;
string a[7] = {"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
int main(void){
  int aa,b;
  int mon[12] = {31,28,
		 31,30,
		 31,30,
		 31,31,
		 30,31,
		 30,31};
  while(cin>>aa>>b,aa+b){
    int d = b;
    for(int i = 0 ; i < aa-1 ; i ++){
      d += mon[i];
      cout<<d<<endl;
    }

    cout<<a[(d+2)%7]<<endl;
  }
  //*/
}

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

int main(){
	int m,d;
	while(true){
		cin >> m >> d;
		if(m == 0)break;
		int M = 1,D = 1;
		for(int i = 0; i < 366; i++){
			if(M == m && D == d){
				if(i % 7 == 0)cout << "Thursday" << endl;
				if(i % 7 == 1)cout << "Friday" << endl;
				if(i % 7 == 2)cout << "Saturday" << endl;
				if(i % 7 == 3)cout << "Sunday" << endl;
				if(i % 7 == 4)cout << "Monday" << endl;
				if(i % 7 == 5)cout << "Tuesday" << endl;
				if(i % 7 == 6)cout << "Wednesday" << endl;
			}
			D++;
			if((M == 1 || M == 3 || M == 5 || M == 7 || M == 8 || M == 10 || M == 12) && (D == 32)){
				M++;
				D = 1;
			}
			if((M == 4 || M == 6 || M == 9 || M == 11) && (D == 31)){
				M++;
				D = 1;
			}
			if(M == 2 && D == 30){
				M++;
				D = 1;
			}
		}
	}
	return 0;
}