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 <string>
using namespace std;
int main(){
int n;
int m;
while(cin >>n>>m){
if(n==0){break;}
if(n==2){n=m+31;}
if(n==3){n=m+60;}
if(n==4){n=m+91;}
if(n==5){n=m+121;}
if(n==6){n=m+152;}
if(n==7){n=m+182;}
if(n==8){n=m+213;}
if(n==9){n=m+244;}
if(n==10){n=m+274;}
if(n==11){n=m+305;}
if(n==12){n=m+335;}
n=n%7;
if(n==1){cout <<"Thursday"}
if(n==2){cout <<"Friday"}
if(n==3){cout <<"Saturday"}
if(n==4){cout <<"Sunday"}
if(n==5){cout <<"Monday"}
if(n==6){cout <<"Tuesday"}
if(n==0){cout <<"Wednesday"}
cout <<endl;}}

C++: #include <iostream>
using namespace std;
int main(void){
    // Here your code !

    string str[7]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
    int month[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
    while(1){
            int m,d,n=0;
    cin>>m>>d;
    if(m==0) break;

    for(int i=1;i<m;i++){
        n=n+month[i];
    }
    n=n+d;
    
  
        
        cout<<str[n%7]<<endl;
    }
}

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

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

using namespace std;


   int main(){
    int m, d, w;
    int days[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    string weekName[7] = {"Sunday", "Monday", "Tuesday", "Wednesday",
                         "Thursday", "Friday", "Saturday"};
    while(1){
        cin >> m >> d;
        if(!(m || d)){
            return 0;
        }
        w = 3;
        for(int i = 1; i < m; i++){
            w += days[i - 1];
        }
        w += d;
        cout << weekName[w % 7] << endl;
    }
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
using namespace std;

int main(){
  int M[13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  string w[7] = {"Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Thuesday"};

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

    int tmp = d;
    for(int i=0; i<m; i++) tmp += M[i];

    cout << w[tmp%7] << endl;
  }

  return 0;
}

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

int main(){
	string week[7] = {"Mondey","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
	int month[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
	int m,d,cnt,mc;

	while( cin >> m >> d ){
		if(m==0) break;

		mc = 1;
		cnt = 3;
		while(1){
			for(int i=1 ; i <= month[mc-1] ; i++, cnt++){
				if(m==mc && d==i) break;
			}
			if(m==mc) break;
			mc++;
		}
		cout << week[cnt%7] << endl;
	}
	return 0;
}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main() {
  int month, dates, day;
  while(cin >> month >> dates) {
    if(month == 0)break;
    day = 3;
    for(int i = 1; i < month; i++) {
      switch(i) {
      case 1:
      case 3:
      case 5:
      case 7:
      case 8:
      case 10:
      case 12:
	day += 31;
	break;
      case 2:
	day += 29;
	break;
      case 4:
      case 6:
      case 9:
      case 11:
	day += 30;
	break;
      }
    }

    day += dates-1;
    day %= 7;
    
    switch(day) {
    case 0:
      cout << "Monday" << endl;
      break;
    case 1:
      cout << "Tuesday" << endl;
      break;
    case 2:
      cout << "Wednesday" << endl;
      break;
    case 3:
      cout << "Thursday" << endl;
      break;
    case 4:
      cout << "Friday" << endl;
      break;
    case 5:
      cout << "Saturday" << endl;
      break;
    case 6:
      cout << "Sunday" << endl;
      break;
    }
  }
}

C++: #include<iostream>
using namespace std;
int main(){
	int m,d;
	for(;;){
		cin >>m>>d;
		if(m == 0 && d == 0){break;}
		if(m == 2){d+=3;}
		else if(m == 3){d+=4;}
		else if(m == 5){d+=2;}
		else if(m == 6){d+=5;}
		else if(m == 8){d+=3;}
		else if(m == 9){d+=6;}
		else if(m == 10){d+=1;}
		else if(m == 11){d+=4;}
		else if(m == 12){d+=6;}
		if(d%7 == 1){cout <<"Thursday"<<endl;}
		else if(d%7 == 2){cout <<"Friday"<<endl;}
		else if(d%7 == 3){cout <<"Saturday"<<endl;}
		else if(d%7 == 4){cout <<"Sunday"<<endl;}
		else if(d%7 == 5){cout <<"Monday"<<endl;}
		else if(d%7 == 6){cout <<"Tuesday"<<endl;}
		else if(d%7 == 0){cout <<"Wednesday"<<endl;}
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using lint = long long int;
using ulint = unsigned long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T, class U> void assign(V<T>& v, int n, const U& a) { v.assign(n, a); }
template<class T, class... Args> void assign(V<T>& v, int n, const Args&... args) { v.resize(n); for (auto&& e : v) assign(e, args...); }


int main() {
  cin.tie(nullptr); ios_base::sync_with_stdio(false);
  V<> d{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  V<string> s{"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
  while (true) {
    int x, y; cin >> x >> y, --x, --y;
    if (x == -1) break;
    int a = 0;
    for (int i = 0; i < x; ++i) a += d[i];
    a += y;
    cout << s[(a + 3) % 7] << '\n';
  }
}