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: # AOJ 0027 What day is today?
# Python3 2018.6.11 bal4u

def Zeller(y, m, d):
    if m == 1 or  m == 2:
        y -= 1
        m += 12
    return (y + y//4 - y//100 + y//400 + (13*m + 8)//5 + d) % 7

import sys
week = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
for line in sys.stdin:
    m, d = list(map(int, line.split()))
    if m >= 1:
        print(week[Zeller(2004, m, d)])
    else:
        break

Python: 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())
print(day[(month[m-1]+d)%7]+'day')

Python: from datetime import *
wd_map = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
while True:
    month, day = map(int, input().split())
    if month == 0:
        break
    print(wd_map[date(2004, month, day).weekday()])

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

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: from datetime import *
for e in iter(input,'0 0'):print(date(2004,*map(int,e.split())).strftime('%A'))

Python: import sys
readline = sys.stdin.readline
write = sys.stdout.write

def convert(y, m, d):
    if m <= 2:
        m += 12
        y -= 1
    mjd = int(365.25*y) + (y//400) - (y//100) + int(30.59*(m-2)) + d - 678912
    return mjd

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

def solve():
    m, d = map(int, readline().split())
    if m == 0:
        return False
    write("%s\n" % youbi[(convert(2004, m, d) - convert(2004, 1, 1) + 3) % 7])
    return True
while solve():
    ...

Python: import sys

def zeller(y,m,d):
  if m==1 or m==2:
    y-=1
    m+=12
  day=(y+int(y/4)-int(y/100)+int(y/400)+int((13*m+8)/5)+d)%7
  D={0:'Sunday',1:'Monday',2:'Tuesday',3:'Wednesday',4:'Thursday',5:'Friday',6:'Saturday'}
  return D[day]
  

for l in sys.stdin:
  m,d=list(map(int,l.split()))
  if m==0:
    break
  print(zeller(2004,m,d))

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: lis=[0 for i in range(7)]
lis[0]="Wednesday"
lis[1]="Thursday"
lis[2]="Friday"
lis[3]="Saturday"
lis[4]="Sunday"
lis[5]="Monday"
lis[6]="Tuesday"
while 1:
    date=0
    x,y=map(int,input().split())
    if x!=0 and y!=0:
        for i in range(1,x):
            if i==4 or i==6 or i==9 or i==11:
                date=date+30
            elif i==2:
                date =date+29
            else:
                date=date+31
        k=(date+y)%7
        print(lis[k])
    else:
        break

Python: month = [0,31,60,91,121,152,182,213,244,274,305,335]
day = ["Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"]
while True:
    a,b = map(int,input().split())
    if a == 0:
        break
    num = month[a-1]+b
    print(day[num%7])

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

try:
	while 1:
		s = raw_input().split()
		s[0] = int(s[0])
		s[1] = int(s[1])
		
		if s[0] + s[1] == 0:
			exit()
		
		n = datetime.date(2004, s[0], s[1]).weekday()
		
		if n == 0:
			print("Monday")
		elif n == 1:
			print("Tuesday")
		elif n == 2:
			print("Wednesday")
		elif n == 3:
			print("Thursday")
		elif n == 4:
			print("Friday")
		elif n == 5:
			print("Saturday")
		elif n == 6:
			print("Sunday")
except:
	pass

Python: from datetime import date
while 1:
	input_data = map(int,raw_input().split())
	day = 0
	if input_data[0] == 0:
		break
	day = date(2004,int(input_data[0]),int(input_data[1])).weekday()
	if day == 6:
		print("Sunday")
	elif day == 0:
		print("Monday")
	elif day == 1:
		print("Tuesday")
	elif day == 2:
		print("Wednesday")
	elif day == 3:
		print("Thursday")
	elif day == 4:
		print("Friday")
	elif day == 5:
		print("Saturday")

Python: dw = ('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday')
dm = (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(dm[i] for i in range(m - 1)) + d - 1
    print(dw[(total + 4) % 7])

Python: import sys
from datetime import *
from time import *

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

while True:
    try:
        user_input_date = '2004/'+'/'.join(input().split())
        if user_input_date == '2004/0/0':
            break
        else:
            a = datetime.strptime(user_input_date,'%Y/%m/%d')
            print(day[a.weekday()])
    except ValueError:
        pass
else:
    sys.exit(1)

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

Python: month = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30]
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: daylist = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
week = ["Wednesday", "Thursday", "Friday", "Saturday",
        "Sunday", "Monday", "Tuesday"]

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

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

    w = week[day % 7]
    print(w)

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

Python: from __future__ import (absolute_import, division, print_function,
                        unicode_literals)
from sys import stdin
from datetime import date

for line in stdin:
    if line.startswith('0 0'):
        break
    print(date(2004, *(int(s) for s in line.split())).strftime('%A'))

Python: ndays = [31,29,31,30,31,30,31,31,30,31,30,31]
days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
offset = 3
while(1):
	m,d = [int(i) for i in input().split()]
	if m == 0 and d == 0:
		break
	tot_d = sum(ndays[:m-1]) + d 
	print(days[(tot_d + offset - 1)%7])