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>
using namespace std;

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

C++: #include<iostream>
#include<cstdio>

using namespace std;

int Month;
int Day;

char *data[] ={
 "Monday",
 "Tuesday",
 "Wednesday",
 "Thursday",
 "Friday",
 "Saturday",
 "Sunday"
};
int days[12] = {31,29,31,30,31,30,31,31,30,31,30,31};

int ans[12][31];
int d = 3;
int main()
{   
    for(int i = 0;i < 12;i++){
      for(int j = 0;j < days[i];j++){
	ans[i][j] = d%7;
	d++;
      }
    }
    while(cin >>Month>>Day){
      if(Month ==0)
	break;
    cout <<data[ans[Month-1][Day-1]]<<endl;
    }
  return 0;
}

C++: #include <iostream>
using namespace std;
int day[]={0,31,29,31,30,31,30,31,31,30,31,30,31};
int main()
{
	int m,d;
	while(cin>>m>>d){
		if(!m)break;
		for(int i=1;i<m;i++)d+=day[i];
		if(d%7==0)cout<<"Wednesday"<<endl;
		else 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;
	}
    return 0;
}

C++: #include<iostream>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
int main(){
	while(1){int a,b;
	cin>>a>>b;
	if(a==0){
	break;}
	if(a==12){b+=335;}else
	if(a==11){b+=305;}else
	if(a==10){b+=274;}else
	if(a==9){b+=244;}else
	if(a==8){b+=213;}else
	if(a==7){b+=182;}else
	if(a==6){b+=152;}else
	if(a==5){b+=121;}else
	if(a==4){b+=91;}else
	if(a==3){b+=60;}else
	if(a==2){b+=31;}
	if(b%7==1){
	cout<<"Thursday"<<endl;}else
		if(b%7==2){
	cout<<"Friday"<<endl;}else
	if(b%7==3){
	cout<<"Saturday"<<endl;}else
		if(b%7==4){
	cout<<"Sunday"<<endl;}else
	if(b%7==5){
	cout<<"Monday"<<endl;}else
	if(b%7==6){
	cout<<"Tuesday"<<endl;}else{
	cout<<"Wednesday"<<endl;}}
	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 || i == 8)
				total += 31;
			else
				total += 30;
		}
		char* days[] = { "Monday", "Tuesday", "Wednesday", "Thursday",
			"Friday", "Saturday", "Sunday" };
		puts(days[(total+2)%7]);
	}
	return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<math.h>
#include<vector>
using namespace std;
int main() {
	int x, y,i;
	vector<int> s;
	s.resize(12);
	s[0] = 0;
	s[1] = 31;
	s[2] = 29;
	s[3] = 31;
	s[4] = 30;
	s[5] = 31;
	s[6] = 30;
	s[7] = 31;
	s[8] = 31;
	s[9] = 30;
	s[10] = 31;
	s[11] = 30;
	while (cin >> x >> y) {
		if (x == 0)break;
		for (i = 0; i < x; i++) {
			y += s[i];
		}
	    if (y % 7 == 1) {
			cout << "Thursday" << endl;
		}
		else if (y % 7 == 2) {
			cout << "Friday" << endl;
		}
		else if (y % 7 == 3) {
			cout << "Saturday" << endl;
		}
		else if (y % 7 == 4) {
			cout << "Sunday" << endl;
		}
		else if (y % 7 == 5) {
			cout << "Monday" << endl;
		}
		else if (y % 7 == 6) {
			cout << "Tuesday" << endl;
		}
		else if (y % 7 == 0) {
			cout << "Wednesday" << endl;
		}
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  int s,n,m,p[12]={31,29,31,30,31,30,31,31,30,31,30,31},i;
  while(cin>>n>>m,n){
    for(s=i=0;i<n-1;i++)s+=p[i];
      s+=m;
    if(s%7==0)cout<<"Wednesday"<<endl;
    else if(s%7==1)cout<<"Thursday"<<endl;
    else if(s%7==2)cout<<"Friday"<<endl;
    else if(s%7==3)cout<<"Saturday"<<endl;
    else if(s%7==4)cout<<"Sunday"<<endl;
    else if(s%7==5)cout<<"Monday"<<endl;
    else cout<<"Tuesday"<<endl;
  }
}

C++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
template<typename V> constexpr typename V::value_type sum(const V &v) { return accumulate(all(v), 0); }
void solve();
main { solve(); return 0; }
// clang-format on

constexpr int fairfield(int y, int m, const int &d) {
  if (m == 1 || m == 2) y--, m += 12;
  return 365 * y + y / 4 - y / 100 + y / 400 + 306 * (m + 1) / 10 + d - 428;
}

void solve() {
  int m, d;
  string t[] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
  while (cin >> m >> d, m) {
    cout << t[(fairfield(2014, m, d) + 1) % 7] << endl;
  }
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
  int calen[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
  int month,day;
  int ans = 0;

  while(cin >> month >> day){
    if(month == 0)break;
    
    ans = 0;

    for(int i = 0;i < month-1;i++){
      ans += calen[i];
    }

    ans += day;

    switch (ans % 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;
    }

  }
}