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: def day(Y, m, d, Gregorian=True):
    from math import floor

    # ツェラーの公式
    if m <= 2:
        Y -= 1
        m += 12
    y = Y%100
    c = Y//100
    g = 5*c+floor(c/4) if Gregorian else 5-c
    return (d + floor(26*(m+1)/10) + y + floor(y/4) +  g) %7 # 0->土曜, 6->金曜

day_en = ["Saturday", "Sunday", "Minday", "Tuesday", "Wednesday", "Thursday", "Friday"]

while True:
    m, d = map(int, input().split())
    if m == 0:
        break
    print(day_en[day(2004, m, d)])

Python: lst = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
while True:
    m, d = map(int, input().split())
    if m == 0:
        break
    
    if m == 1 or m == 4 or m == 7:
        print(lst[(d + 2) % 7])

    elif m == 2 or m == 8:
        print(lst[(d + 5) % 7])

    elif m == 3 or m == 11:
        print(lst[(d + 6) % 7])

    elif m == 5:
        print(lst[(d + 4) % 7])

    elif m == 6:
        print(lst[d % 7])

    elif m == 9 or m == 12:
        print(lst[(d + 1) % 7])

    else:
        print(lst[(d + 3) % 7])

Python: import math
def Wit(y,m,d):
    if m == 1 or m == 2:
        y -= 1
        m += 12
    e = math.floor((26 * (m + 1)) / 10)
    Y = y % 100
    C = math.floor(y / 100)
    f = math.floor(C / 4)
    g = math.floor(Y / 4)
    h = d + e + Y + f + g + 5 * C
    h = int(h % 7)
    return h
while True:

    y = 2004
    m,d = map(int,input().split())
    if m == 0 and d == 0:
        break
    You = Wit(y,m,d)
    if You == 1:
        print("Sunday")
    elif You == 3:
        print("Tuesday")
    elif You == 2:
        print("Monday")
    elif You == 4:
        print("Wednesday")
    elif You == 5:
        print("Thursday")
    elif You == 6:
        print("Friday")
    elif You == 0:
        print("Saturday")

Python: import datetime

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

while True:
    m,d=[int(i) for i in input().split(" ")]
    if m==0 and d==0:
        break

    date=datetime.datetime(2004,m,d)
    print(num2wd[date.weekday()])

Python: f = lambda x:x%7
p = print

def judge(x):
    if  f(x)== 1:
        p("Thursday")
    elif f(x) == 2:
        p("Friday")
    elif f(x) == 3:
        p("Saturday")
    elif f(x) == 4:
        p("Sunday")
    elif f(x) == 5:
        p("Monday")
    elif f(x) == 6:
        p("Tuesday")
    else:
        p("Wednesday")

days = [31,29,31,30,31,30,31,31,30,31,30,31]
while True:
    month,day = [int(i) for i in input().split()]
    if month == 0:
        break
    elif month == 1:   
        x = day
    else:
        x = sum(days[:month-1]) + day
    judge(x)

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

Python: import datetime

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

while True:
    m,d = [int(i) for i in input().split()]
    if not(m or d):
        break
    print(weekdays[datetime.date(2004, m, d).weekday()])

Python: import datetime

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

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

Python: while True:
    a,b=map(int,input().split())
    c=0
    if a==0:
        break
    tuki=[31,29,31,30,31,30,31,31,30,31,30,31]
    a-=1
    for i in range(a):
        c=c+tuki[i]
    c+=b
    if c%7==1:
        ans="Thursday"
    if c%7==2:
        ans="Friday"
    if c%7==3:
        ans="Saturday"
    if c%7==4:
        ans="Sunday"
    if c%7==5:
        ans="Monday"
    if c%7==6:
        ans="Tuesday"
    if c%7==0:
        ans="Wednesday"
    print(ans)

Python: day=['0','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday']
mou=[0,31,29,31,30,31,30,31,31,30,31,30,31]
while True:
	try:
		n,m=map(int,input().split())
	except:
		break
	if n==0 and m==0:
		break
	count=0
	for a in range(1,n+1):
		if a==n :
			count+=m
		else:
			count+=mou[a]
	print(day[count%7+3])

Python: while True:
    m, d = map(int, raw_inpud().split())
    if m == 0 and d == 0:
        break

Python: if __name__ == '__main__':

	W = ["Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"]
	Y = [31,29,31,30,31,30,31,31,30,31,30,31]

	while True:
		m,d = map(int,input().split())
		if m == 0 and d == 0:
			break

		day = 0
		for i in range(m-1):
			day += Y[i]
		day += d

		ans = day % 7
		print(W[ans-1])

Python: from datetime import date

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

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

  print(dic[date(2004, month, day).weekday()])

Python: def day(x,y):
	start=0
	if x==2 or x==8 :
		start=0
	elif x==3 or x==11:
		start=1
	elif x==6:
		start=2
	elif x==9 or x==12:
		start=3
	elif x==1 or x==4:
		start=4
	else:
		start=6
	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))

Python: import datetime

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

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

Python: import sys

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


def getPNoD(n):
  if n == 1:
    return 0
  elif n == 3:
    return 29
  elif (n % 2 == 0 and n <= 8) or (n % 2 != 0 and n > 8):
    return 31 + getPNoD(n-1)
  else:
    return 30 + getPNoD(n-1)


for line in sys.stdin:
  m, d = [int(i) for i in line.split()]
  if m == 0:
    break
  n = getPNoD(m) + d - 1
  print(DoD[n % 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(204, m, d).weekday()])