Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
	"time"
)

var sc = bufio.NewScanner(os.Stdin)

//Sliceconvtoi ...
func Sliceconvtoi() []int {
	strs := strings.Split(sc.Text(), " ")

	var ints []int
	var x int

	for _, s := range strs {
		x, _ = strconv.Atoi(s)
		ints = append(ints, x)
	}

	return ints
}

func main() {
	for sc.Scan() {
		i := Sliceconvtoi()

		if i[0] == 0 && i[1] == 0 {
			break
		}

		m := time.Month(i[0])
		d := i[1]
		t := time.Date(2004, m, d, 0, 0, 0, 0, time.Local)
		fmt.Println(t.Weekday())
	}

}

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

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 = map(int, input().split())
while m:
    days = month[m] + d
    print(week[days % 7])
    m, d = map(int, input().split())

Python: from datetime import date
dic={3:"Thursday",4:"Friday",5:"Saturday",6:"Sunday",0:"Monday",1:"Tuesday",2:"Wednesday"}
while True:
    m,d=map(int,input().split())
    if m==0 and d==0:
        break
    print(dic[date(2004,m,d).weekday()])

Python: from datetime import datetime

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

while True:
    line = input()
    if line.strip() == '0 0':
        break
    else:
        month, day = map(int, line.strip().split(' '))
        f = '%Y-%m-%d'
        a = datetime.strptime('2004-{}-{}'.format(month, day), f)
        print(youbi[a.weekday()])

Python: from datetime import date
import calendar


while True:
    m,d = map(int,(input().split()))
    if m == 0 and d == 0:
        break
    x = date(2004,m,d).weekday()
    print(["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"][x])

Python: month = [3, 1, 3, 2, 3, 2, 3, 3, 2, 3, 2, 3]

while True:
  m, d = map(int, input().split())
  if m == 0:
    break
  piv = 3
  for i in range(m-1):
    piv += month[i]
  piv += d
  piv %= 7
  if piv == 0:
    print("Sunday")
  elif piv == 1:
    print("Monday")
  elif piv == 2:
    print("Tuesday")
  elif piv == 3:
    print("Wednesday")
  elif piv == 4:
    print("Thursday")
  elif piv == 5:
    print("Friday")
  elif piv == 6:
    print("Saturday")

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

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 or x==7:
		start=4
	elif x==10:
		start=5
	elif x==5:
		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))