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>
#include <vector>
#include <cmath>
#include <iomanip>
#include <string>
#include <queue>
#include <algorithm>
#include <cctype>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const double pi=acos(-1);

int x,y,tu[11]={31,29,31,30,31,30,31,31,30,31,30};

int main(){
	while(1){
		cin>>x>>y;
		if(!x&&!y) break;
		int num=0;
		for(int i=0;i<x-1;i++) num+=tu[i];
		num+=y;
		int ans=num%7;
		if(ans==1) cout<<"Thursday"<<endl;
		else if(ans==2) cout<<"Friday"<<endl;
		else if(ans==3) cout<<"Saturday"<<endl;
		else if(ans==4) cout<<"Sunday"<<endl;
		else if(ans==5) cout<<"Monday"<<endl;
		else if(ans==6) cout<<"Tuesday"<<endl;
		else if(!ans) cout<<"Wednsday"<<endl;
	}
}

C++: #include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#define PI 3.1415926535897932384626433
using namespace std;
int main(){
    int days[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
    int rui[13]={0};
    for(int i=1;i<=12;i++)rui[i]=rui[i-1]+days[i];
    int a,b;
    while(cin>>a>>b){
        int p=rui[a-1]+b;
        if(p%7==0)cout<<"Wednesday"<<endl;
        if(p%7==1)cout<<"Thursday"<<endl;
        if(p%7==2)cout<<"Friday"<<endl;
        if(p%7==3)cout<<"Saturday"<<endl;
        if(p%7==4)cout<<"Sunday"<<endl;
        if(p%7==5)cout<<"Monday"<<endl;
        if(p%7==6)cout<<"Tuesday"<<endl;
    }
    return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string.h>
#include <queue>
#include <stack>
#include <utility>
#include <queue>
#include <cmath>
#define mp make_pair
#define pii pair<int,int> 
#define ff first
#define ss second

using namespace std;

int month[20]={0,31,29,31,30,31,30,31,31,30,31,30,31};
string days[10]={" ","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
int a,b,c;
int main()
{
	while(1)
	{
		scanf("%d %d",&a,&b);
		c=0;
		if(a==0&&b==0)
		{
			break;
		}
		for(int i=1;i<a;i++)
		{
			c+=month[i];
		}
		c+=b;
		c%=7;
		c+=3;
		printf("%d\n",c);
		cout<<days[c]<<endl;
	}
	return 0;
}

C++: #include <iostream>
int main(){
	int m[12];
	char q;
	m[1]=31,m[2]=29,m[3]=31,m[4]=30,m[5]=31,m[6]=30,m[7]=31,m[8]=31,m[9]=30,m[10]=31,m[11]=30,m[12]=31;
	int mm,d;
	while(std::cin>>mm>>d&&mm!=0&&d!=0){
		int y=0;
		for(int a=1;a<mm;a++){
			y=y+m[a];
		}
		
		if((y+d)%7==1){
			std::cout<<"Thursday"<<std::endl;
		}if((y+d)%7==2){
		std::cout<<"Friday"<<std::endl;
		}
		if((y+d)%7==3){
		std::cout<<"Saturday"<<std::endl;
		}
		if((y+d)%7==4){
		std::cout<<"Sunday"<<std::endl;
		}
		if((y+d)%7==5){
		std::cout<<"Monday"<<std::endl;
		}
		if((y+d)%7==6){
		std::cout<<"Tuesday"<<std::endl;
		}
		if((y+d)%7==0){
			std::cout<<"Wednesday"<<std::endl;
		}
		
	}
	return 0;
}

C++: #include<cstdio>
#include<ctime>
int mtod(int month){
  int result=0;
  if(month>1) result+=31;
  if(month>2) result+=29;
  if(month>3) result+=31;
  if(month>4) result+=30;
  if(month>5) result+=31;
  if(month>6) result+=30;
  if(month>7) result+=31;
  if(month>8) result+=31;
  if(month>9) result+=30;
  if(month>10) result+=31;
  if(month>11) result+=30;
  return result;
}
int main(){
  for(;;){
    int m,d;
    scanf("%d %d",&m,&d);
    if(!(m|d)){break;}
    int diff=mtod(m)+d-1;
    switch(diff%7){
    case 0:puts("Thursday");break;
    case 1:puts("Friday");break;
    case 2:puts("Saturday");break;
    case 3:puts("Sunday");break;
    case 4:puts("Monday");break;
    case 5:puts("Tuesday");break;
    case 6:puts("Wednesday");break;
    }
  }
}

C++: #include <iostream>
int main(void){
    int month,day,chek;
    while(std::cin >> month >> day,month){ int year = 2004;
    if(month == 1 || month == 2){year--;month+=12;}
    chek = ((year+ year/4-year/100+year/400+(13*month+8)/5+day)%7);
    switch (chek) {case 0:puts("Sunday");break; case 1:puts("Monday");break; case 2:puts("Tuesday");break; case 3:puts("Wednesday");break;
        case 4:puts("Thursday");break; case 5:puts("Friday");break; case 6:puts("Saturday");break; }}return 0;}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <iostream>


using namespace std;

int main()
{
	int m, d;
	while (true)
	{
		scanf("%d %d", &m, &d);
		if (m == 0 && d == 0)
			break;

		int total = d;
		for (int i = 1; i < m; ++i)
		{
			if (i == 2)
				total += 29;
			else if (i & 1)
				total += 31;
			else
				total += 30;
		}
		char* days[] = { "Monday", "Tuesday", "Wednesday", "Thursday",
			"Friday", "Saturday", "Sunday" };
		puts(days[(total+2)%7]);
	}
	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("Thursday\n");break;

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

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

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> pint;
#define rep(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
int dx[]={1,-1,0,0},dy[]={0,0,1,-1};

int day[]={0,31,29,31,30,31,30,31,31,30,31,30,31};
int main(){
	int m,d;
	for(;cin>>m>>d,m;){
		for(int i=1;i<m;i++){
			d+=day[i];
		}
		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;
		break;
		}
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
int m,d,h,y;
char w[][7]={"Satur","Sun","Mon","Tues","Wednes","Thurs","Fri"};
for(;;){
y=4;
cin>>m>>d;
if(m==0)break;
if(m<3){m+=12;y--;}
h=(y+int(y/4)+int(2.6*(m+1))+d)%7;
cout<<h<<endl;
cout<<w[h]<<"day"<<endl;
}
return 0;
}