Go: package main

import (
        "fmt"
)

func main() {
        var weeks = []string{"Thursday",
                "Friday",
                "Saturday",
                "Sunday",
                "Monday",
                "Tuesday",
                "Wednesday"}

        for {
                var m, d int
                _, err := fmt.Scanf("%d %d", &m, &d)
                if err != nil || m + d == 0 {
                        break
                }
                var days int

                for {
                        lm, ld := getLastDay(m, d)
                        if lm + ld == 0 {
                                break
                        }
                        days++
                        m = lm
                        d = ld
                }
                fmt.Println(weeks[days%7])
        }
}

func getLastDay(m int, d int) (lm int, ld int) {
        if m == 1 && d == 1 {
                return 0, 0
        }

        if d > 1 {
                return m, d-1
        } else {
                if m == 3 {
                        return m-1, 29
                }
                if m == 3 || m == 5 || m == 7 || m == 10 || m == 12 {
                        return m-1, 30
                } else {
                        return m-1, 31
                }
        }
}

Python: # -*- coding: utf-8 -*-

import sys
import os
import datetime

DAY_OF_WEEK = ['Thursday', 'Friday', 'Saturday', 'Sunday', 'Monday', 'Tuesday', 'Wednesday']
MONTH = [0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

for s in sys.stdin:
    month, day = map(int, s.split())
    if month == day == 0:
        break

    past_day = sum(MONTH[:month]) + day - 1

    a = past_day % 7
    print(DAY_OF_WEEK[a])

Python: while 1:
    m,d=map(int,input().split())
    if m==0:break
    print(['Wednes', 'Thurs', 'Fri', 'Satur', 'Sun', 'Mon', 'Tues'][([0,31,60,91,121,152,182,213,244,274,305,335][m-1]+d)%7]+'day')

Python: month = [31, 30, 29, 30, 31, 30, 31, 31, 30, 31, 30, 31]
day = ['Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday', 'Monday', 'Tuesday']
while True:
    m, d = map(int, input().split())
    if m == 0:
        break
    print(day[(sum(month[:m - 1]) + d) % 7])

Python: import datetime
for e in iter(input,'0 0'):print(['Mon','Tues','Wednes','Thurs','Fri','Satur','Sun'][datetime.date(2004,*map(int,e.split())).weekday()]+'day')

Python: ans ={}
for i in range(1,13):
    if i%2 !=0:
        ans[str(i)] = 31
    else:
        ans[str(i)] = 30
ans['2']=29 
while True:
    a,b=map(int,raw_input().split())
    day =b
    if a+b == 0: break;
    if a == 1:   day = b;
    elif a == 2: day+=31
    else:
        for i in range(a):
            if i ==0: pass;
            day += ans[str(i)]
    print ['Wednesday','Thurday','Friday',
            'Saturday','Sunday','Monday',
            'Tuesday'][day%7]

Python: #!/usr/bin/python

import datetime

days = [
    'Monday',
    'Tuesday',
    'Wednesday',
    'Thursday',
    'Friday',
    'Saturday',
    'Sunday'
        ]

while True:
    m, d = map(int, input().split(' '))
    if m == 0: break
    print(days[datetime.date(2004, m, d).weekday()])

Python: import sys
from datetime import *
for line in sys.stdin:
    m, d = map(int,line.split())
    try:
        print(date(2004, m, d).strftime("%A"))
    except ValueError:
        break

Python: 
import datetime
L = [ "Monday", "Tuesday", "Wednesday", "Thursday","Friday",
      "Saturday", "Sunday" ]

while True:
    m, d = [int(x) for x in input().split()]
    if m == 0 and d == 0:
        break
    dt = datetime.datetime(2004, m, d)
    w = dt.weekday()
    print(L[w])

Python: 
day = (
       'Sunday',
       'Monday',
       'Tuesday',
       'Wednesday',
       'Thursday',
       'Friday',
       'Saturday',
)
mm = {1:4,
      2:0,
      3:1,
      4:4,
      5:6,
      6:2,
      7:4,
      8:0,
      9:3,
      10:5,
      11:1,
      12:3,
      }
while 1:
    m, d = list(map(int, input().split()))
    if m == 0:
        break
    print(day[(mm[m] + d - 1)%7])

Python: day = [0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30]
for i in range(2,12):
    day[i] += day[i-1]
week = ['Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday', 'Monday', 'Tuesday']
while True:
    M, D = map(int, input().split())
    if M==0:
        break
    days = day[M-1] + D
    print(week[days%7])

Python: daymonth = [0, 2, 5, 6, 2, 4, 0, 2, 5, 1, 3, 6, 1]
str = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]


#print(input().split(" "))

m = 1
d = 1

while m!=0:
	md = input().split(" ")
	m = int(md[0])
	d = int(md[1])
	if m != 0:
		print(str[(daymonth[m] + d) % 7])

Python: from datetime import date
while True:
    m, d = map(int, input().split())
    if m == 0:
        break
    result = date(2004, m, d).isoweekday()
    print("Mon"*(result==1)+"Tues"*(result==2)+"Wednes"*(result==3)+"Thurs"*(result==4)+"Fri"*(result==5)+"Satur"*(result==6)+"Sun"*(result==7)+"day")

Python: # -*- coding:utf-8 -*-
import datetime


def main(a, b):
    dt = datetime.datetime(2004, a, b)
    week_num = dt.weekday()

    if week_num == 0:
        print('Monday')
    elif week_num == 1:
        print('Tuesday')
    elif week_num == 2:
        print('Wednesday')
    elif week_num == 3:
        print('Thursday')
    elif week_num == 4:
        print('Friday')
    elif week_num == 5:
        print('Saturday')
    elif week_num == 6:
        print('Sunday')


while True:
    a, b = [int(e) for e in input().split()]
    if a == 0 and b == 0:
        break

    main(a, b)

Python: import datetime
while 1:
    m,d=map(int,input().split())
    if m==d==0:break
    ans=datetime.datetime(2004, m, d)
    print(ans.strftime('%A'))

Python: from datetime import *
for e in iter(input,'0 0'):print(date(2004,*map(int,e.split())).strftime("%A"))

Python: import datetime
import calendar

def trans(month, day, year=2004):
    past = datetime.date(year, month, day)
    result = calendar.day_name[past.weekday()]
    return result
    
while True:
    month, day = map(int, input().split())
    if month == day == 0: break
    print(trans(month, day))

Python: #datetimeモジュールをインポートする
import datetime

#aとbが0になるまで処理を繰り返す
while True:
    a,b = map(int,input().split())
    if a == 0 and b == 0:break

    #detetimeモジュールを使い、youbiに代入し、"strftime"を使い、曜日を取得する
    youbi = datetime.datetime(2004,a,b)
    print(youbi.strftime("%A"))

Python: while True:
    m, d = map(int, input().split())
    if m == d == 0:
        break
    dim = {1: 0, 2: 31, 3: 60, 4: 91, 5: 121, 6: 152, 7: 182, 8: 213, 9: 244, 10: 274, 11: 305, 12: 335}
    ds = dim[m] + d -1
    print({0:'Thursday', 1:'Friday', 2:'Saturday', 3:'Sunday', 4:'Monday', 5:'Tuesday', 6:'Wednesday'}[ds % 7])

Python: while True:
    q=map(int,raw_input().split())
    if sum(q) == 0: break
    print ['Wednesday','Thursday','Friday','Saturday','Sunday','Monday','Tuesday',0][(sum([0,31,29,31,30,31,30,31,31,30,31,30,31][:q[0]])+q[1])%7]

Python: W = ('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday')
M = (31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
 
while True:
    m, d = map(int, input().split())
    if m == d == 0: break
 
    total = sum(M[i] for i in range(m - 1)) + d - 1
    print(W[(total + 4) % 7])

Python: week = {"1": "Thursday", "2": "Friday", "3": "Saturday", "4": "Sunday", "5": "Monday", "6": "Tuesday", "7": "Wednesday"}
month = {"1": 0, "2": 31, "3": 60, "4": 91, "5": 121, "6": 152, "7": 182, "8": 213, "9": 244, "10": 274, "11": 305, "12": 335}
m, d = input().split()
while m != "0":
    days = month[m] + int(d)
    print(week[str(days % 7)])
    m, d = input().split()

Python: import datetime
for e in iter(input,'0 0'):print(['Mon','Tues','Wednes','Thurs','Fri','Satur','Sun'][datetime.date(2004,*map(int,e.split())).weekday()]+'day')