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 a,b=0,c,tuki,hi;
	for(;;){
	cin>>tuki>>hi;
	if(tuki==0&&hi==0){
		break;
	}
	for(a=1;a<=hi;a++){
		b++;
	}
	if(tuki==1){
		b=b+31;
	}else if(tuki==2){
		b=b+31+29;
	}else if(tuki==3){
		b=b+31+29+31;
	}else if(tuki==4){
		b=b+31+29+31+30;
	}else if(tuki==5){
		b=b+31+29+31+30+31;
	}else if(tuki==6){
		b=b+31+29+31+30+31+30;
	}else if(tuki==7){
		b=b+31+29+31+30+31+30+31;
	}else if(tuki==8){
		b=b+31+29+31+30+31+30+31+31;
	}else if(tuki==9){
		b=b+31+29+31+30+31+30+31+31+30;
	}else if(tuki==10){
		b=b+31+29+31+30+31+30+31+31+30+31;
	}else if(tuki==11){
		b=b+31+29+31+30+31+30+31+31+30+31+30;
	}else if(tuki==12){
		b=b+31+29+31+30+31+30+31+31+30+31+30+31;
	}
	c=b%7;
	if(c==0){
		cout<<"Monday";
	}else if(c==1){
		cout<<"Tuesday";
	}else if(c==2){
		cout<<"Wednesday";
	}else if(c==3){
		cout<<"Thursday";
	}else if(c==4){
		cout<<"Friday";
	}else if(c==5){
		cout<<"Saturday";
	}else if(c==6){
		cout<<"Sunday";
	}
	cout<<endl;
	}
}

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

int main(void)
{
	int month, day, sum = 0, s_y = 3;
	int m_and_D[13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	char select_y[7][10] = 
	{"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sanday"};

	while(scanf("%d %d",&month, &day) && month > 0)
	{
		s_y = 3;
		sum = 0;
		for(int f1 = 1; f1 < month; f1++)
		{
			sum += m_and_D[f1];
		}

		sum += day - 1;
		s_y = (sum + s_y) % 7;

		printf("%s\n",select_y[s_y]);
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
using namespace std;
typedef long long int ll;

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

int day(int n){
	if(n==1)return 0;
	else{
		int res;
		n--;
		if(n==1||n==3||n==5||n==7||n==8||n==10||n==12){
			res=31;
		}
		else if(n==2){
			res=29;
		}
		else{
			res=30;
		}
		return res+day(n);
	}
}


int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	while(1){
		int n; cin >> n;
		if(n==0)break;
		int m; cin >> m;
		int sum=m+day(n);
		cout << s[sum%7] << endl;
	}
}

C++: #include<stdio.h>
int main()
{
  int month,date,ans;
  while(1)
    {
      scanf("%d%d",&month,&date);
      if((month==0)&&(date==0)) break;
      ans=date;
      switch(month)
	{
	case 12:
	  ans+=30;
	case 11:
	  ans+=31;
	case 10:
	  ans+=30;
	case 9:
	  ans+=31;
	case 8:
	  ans+=31;
	case 7:
	  ans+=30;
	case 6:
	  ans+=31;
	case 5:
	  ans+=30;
	case 4:
	  ans+=31;
	case 3:
	  ans+=29;
	case 2:
	  ans+=31;
	}
      ans%=7;
      switch(ans)
	{
	case 0:
	  printf("Wednesday\n");
	  break;
	case 1:
	  printf("Thursday\n");
	  break;
	case 2:
	  printf("Friday\n");
	  break;
	case 3:
	  printf("Saturday\n");
	  break;
	case 4:
	  printf("Sunday\n");
	  break;
	case 5:
	  printf("Monday\n");
	  break;
	case 6:
	  printf("Tuesday\n");
	  break;
	}	  	  	  	  
    }
  return 0;
}

C++: #include<stdio.h>

int main(void){
	int m,d,now;
	char da[7][15]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
	for(;;){
		now=0;
		scanf("%d %d",&m,&d);
		if(!m||!d)break;
		for(int i=1;i<m;i++){
			now+= i==2 ? 29 : (i<8 ? 30+i%2 : 31-i%2);
		}
		now+=d;
		printf("now= %d\n",now);
		printf("%s\n",&da[now%7]);
	}
	return 0;
}

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

int cntday(int m, int d);
void disp(int n);

int main(){
	int month, day, n;
	while(cin >>month >>day){
		if(month == 0) break;
		n = cntday(month, day);
		disp(n);
	}
	return 0;
}

int cntday(int m, int d){
	int ans = d, month[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	for(int i = 0; i < m - 1; i++){
		ans += month[i];
	}
	return ans;
}

void disp(int n){
	int cnt = n % 7;
	switch(cnt){
		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;
	}
}

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

int main()
{
	int a, b, count = 0;
	int ans[100];
	while (cin >> a >> b) {
		if (a == 0 && b == 0)
			break;
		if (a == 1 || a == 4 || a == 7) {
			ans[count] = b % 7 + 3;
		}
		else if (a == 9 || a == 12) {
			ans[count] = b % 7 + 2;
		}
		else if (a == 2 || a == 8) {
			ans[count] = b % 7 + 6;
		}
		else if (a == 3 || a == 11) {
			ans[count] = b % 7;
		}
		else if (a == 5) {
			ans[count] = b % 7 + 5;
		}
		else if (a == 6) {
			ans[count] = b % 7 + 1;
		}
		else if (a == 10) {
			ans[count] = b % 7 + 4;
		}
		count++;
	}
	for (int i = 0; i < count; i++) {
		if (ans[i] == 1)
			cout << "Monday" << endl;
		else if (ans[i] == 2)
			cout << "Tuesday" << endl;
		else if (ans[i] == 3)
			cout << "Wednesday" << endl;
		else if (ans[i] == 4)
			cout << "Thursday" << endl;
		else if (ans[i] == 5)
			cout << "Friday" << endl;
		else if (ans[i] == 6)
			cout << "Saturday" << endl;
		else if (ans[i] == 7)
			cout << "Sunday" << endl;
	}
}

C++: #include <iostream>

using namespace std;

int M[]{0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366};
string W[]{"Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"};

int main() {
    int m, d;
    while (cin >> m >> d) {
        if (m == 0) break;
        cout << W[(M[m - 1] + d - 1) % 7] << endl;
    }
}

C++: #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};

  while ( cin >> m >> d && 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>

using namespace std;

int main(void) {
	while(1) {
		int mon, day;
		cin >> mon;
		
		if( mon == 0 )		break;
		
		cin >> day;
		
		for(int i = 1; i < mon; i++) {
			switch(i) {
			case 2:
				day += 29;
				break;
			case 4:
			case 6:
			case 9:
			case 11:
				day += 30;
				break;
			default:
				day += 31;
				break;
			}
		}
		
		switch(day % 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;
			break;
		}
	}
	
	return 0;
}

C++: #include<cstdio>
int main()
{
    int mo,da;
    int cal[12]={0,31,29,31,30,31,30,31,31,30,31,30};
    while(scanf("%d%d",&mo,&da),mo)
    {
        int nu=0;
        for(int i=0;i<mo;i++)nu+=cal[i];
        nu+=da;
        if(nu%7==1)printf("Thursday\n");
        else if(nu%7==2)printf("Friday\n");
        else if(nu%7==3)printf("Saturday\n");
        else if(nu%7==4)printf("Sunday\n");
        else if(nu%7==5)printf("Monday\n");
        else if(nu%7==6)printf("Tuesday\n");
        else if(nu%7==0)printf("Wednesday\n");
    }
    return 0;
}