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])
	}
}

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

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

Python: # Aizu Problem 0027: What day is today?
#
import sys, math, os, datetime

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


DAY = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
while True:
    m, d = [int(_) for _ in input().split()]
    if m == d == 0:
        break
    print(DAY[datetime.date(2004, m, d).weekday()])

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

Python: from datetime import date
week=["Monday","Trueday","Wednesday","Thursday","Friday","Saturday","Sunday"]
while True:
    a,b=map(int,input().split())
    if a==0:
        break
    print(week[date(2004,a,b).weekday()])

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

Python: import datetime
import sys

week = {0:'Monday', 1:'Tuesday', 2:'Wednesday', 3:'Thursday', 4:'Friday', 5:'Saturday', 6:'Sunday'}

f = sys.stdin
while True:
    month, date = map(int, f.readline().split())
    if month == 0:
        break
    day = datetime.date(2004, month, date)
    print(week[day.weekday()])

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

Python: month = [0,31,29,31,30,31,30,31,31,30,31,30,31]
week = ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday']

while True:
    m,d = list(map(int,input().split()))
    if m == 0 and d == 0:
        break
    day = 3
    x = 1
    y = 1
    while x != m or y != d:
        if y == month [x]:
            x += 1
            y = 1
        else:
            y += 1
        day += 1
        day %= 7
    print(week [day])

Python: while True:
    a,b=map(int,raw_input().split())
    if a+b==0: break
    kari,day=a,0
    if a>2:
        day+=31+29+b
        kari-=2
        tt = range(1,kari+1)
        for i in tt:
            if kari == 1: break
            if i %2 != 0:
                day+=31
            elif i%2 == 0:
                day+=30
            kari -=1
    else:
        if a == 1:
            day = b
        elif a == 2:
            day = 31+b

    print ['Thursday','Friday','Saturday','Sunday','Monday','Tuesday','Wednesday'][(day%7)-1]

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

Python: accum = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335]
youbi = ["Wednesday", "Thursday", "Friday", "Saturday",
         "Sunday", "Monday", "Tuesday", ]


def getYoubi(month, day):
    total = accum[month - 1] + day
    return youbi[total % 7]


month = 13
day = 32

while True:
    month, day = map(int, input().split())
    if month == 0:
        break
    print(getYoubi(month, day))

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

import sys
import os
import datetime

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

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

    if month == 2 and day == 29:
        yday = datetime.date(2014, month, day - 1).timetuple().tm_yday + 1
    elif month == 3:
        yday = datetime.date(2014, month, day).timetuple().tm_yday + 1
    else:
        yday = datetime.date(2014, month, day).timetuple().tm_yday

    a = DAY_OF_WEEK[(3 + yday) % 7]
    print(a)

Python: from datetime import date
while True:
    m, d = map(int, input().split())
    if m == 0:
        break
    result = date(2004, m, d).isoweekday()
    print("Monday"*(result==1)+"Tuesday"*(result==2)+"Wednesday"*(result==3)+"Thursday"*(result==4)+"Friday"*(result==5)+"Saturday"*(result==6)+"Sunday"*(result==7))

Python: import datetime

date_list = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]

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

Python: import datetime
yobi = {0:"Monday",1:"Tuesday",2:"Wednesday",3:"Thursday",4:"Friday",5:"Saturday",6:"Sunday"}
try:
    while True:
        m, d= map(int, input().split())
        if m == 0 and d == 0 :
            exit()
        day = datetime.datetime.strptime("2004/" + str(m) + "/" + str(d),"%Y/%m/%d")
        if day.weekday() in yobi:
            output = yobi[int(day.weekday())]
            print(output)
except EOFError:
    pass

Python: while True:
    month,day=list(map(int, input().split()))
    if month==day==0:
        break
    month_day=[30,29,31,30,31,30,31,31,30,31,30,31]             #1から12
    tmp_day=0
    for i in range(month-1):
        tmp_day+=month_day[i]
    tmp_day+=day
    amari=tmp_day%7
    if month==day==1:
        print("Thursday")
    elif amari==0:
        print("Thursday")
    elif amari==1:
        print("Friday")
    elif amari==2:
        print("Saturday")
    elif amari==3:
        print("Sunday")
    elif amari==4:
        print("Monday")
    elif amari==5:
        print("Tuesday")
    elif amari==6:
        print("Wednesday")

Python: from datetime import date
import sys
for line in sys.stdin.readlines():
   m , d = map(int,line.split())
   if m != 0 and d != 0 :
       val = date(2004,m,d)
       day = val.isoweekday()
       if day == 7:
           print("Sunday")
       elif day == 1:
           print("Monday")
       elif day == 2:
           print("Tuesday")
       elif day == 3:
           print("Wednesday")
       elif day == 4:
           print("Thursday")
       elif day == 5:
           print("Friday")
       else:
           print("Saturday")
   else:
       break

Python: import sys
from datetime import *

for line in sys.stdin:
    a, b = map(int,line.split())
    try:
        print(date(2004, a, b).strftime("%A"))
    except ValueError:
        break

Python: DAY_OF_WEEK = ['Sunday', 'Monday', 'Tuesday',
               'Wednesday', 'Thursday', 'Friday', 'Saturday']
def day_of_week(y, m, d):
    # ?????\?????????(?????§???????????¬???)
    # ??\?????\???0,????????\???6
    # Zeller's congruence
    if m == 1 or m == 2:
        m += 12
        y -= 1
    h = (y + y // 4 - y // 100 + y // 400 + (13 * m + 8) // 5 + d) % 7
    return h

while True:
    m,d = map(int, input().split())
    if m==0:
        exit()
    print(DAY_OF_WEEK[day_of_week(2004,m,d)])

Python: def day(x,y):
	start=0
	if (x==1 or x==10):
		start=3
	elif (x==2 or x==3 or x==11):
		start=6
	elif (x==4 or x==7):
		start=2
	elif x==5:
		start=4
	elif x==6:
		start=0
	elif x==8:
		start=5
	else:
		start=1
	day=(start+y)%7
	if day==1:
		return "Sunday"
	elif day==2:
		return "Monday"
	elif day==3:
		return "Tuesday"
	elif day==4:
		return "Wednesday"
	elif day==5:
		return "Thursday"
	elif day==6:
		return "Friday"
	else:#0
		return "Saturday"


while True:	
	x,y=map(int,input().split())
	if x==y==0:
		break
	print(day(x,y))