Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func zeller(month, day int) int {
	year := 2004
	if month == 1 || month == 2 {
		year--
		month += 12
	}
	return (year + year/4 - year/100 + year/400 + (13*month+8)/5 + day)%7
}

func main() {
	scanner.Split(bufio.ScanWords)
	for {
		month := nextInt()
		day := nextInt()
		if month == 0 && day == 0{
			break
		}
		switch zeller(month, day) {
		case 0:
			fmt.Println("Sunday")
		case 1:
			fmt.Println("Monday")
		case 2:
			fmt.Println("Tuesday")
		case 3:
			fmt.Println("Wednesday")
		case 4:
			fmt.Println("Thursday")
		case 5:
			fmt.Println("Friday")
		case 6:
			fmt.Println("Saturday")
		}
	}
}

Python: while True :
    M, D = map(int, input().split())
    if M == 0 and D == 0 :
        break

    else :
        if M == 1 :
            days = D
        elif M == 2 :
            days = 31 + D
        elif M == 3 :
            days = 31+29+D
        elif M == 4 :
            days = 31+29+31+D
        elif M == 5 :
            days = 31+29+31+30+D
        elif M == 6 :
            days = 31+29+31+30+31+D
        elif M == 7 :
            days = 31+29+31+30+31+30+D
        elif M == 8 :
            days = 31+29+31+30+31+30+31+D
        elif M == 9 :
            days = 31+29+31+30+31+30+31+31+D
        elif M == 10 :
            days = 31+29+31+30+31+30+31+31+30+D
        elif M == 11 :
            days = 31+29+31+30+31+30+31+31+30+31+D
        elif M == 12 :
            days = 31+29+31+30+31+30+31+31+30+31+30+D
            
        youbi = days % 7
        if youbi == 0 :
            print("Wednesday")
        elif youbi == 1 :
            print("Thursday")
        elif youbi == 2 :
            print("Friday")
        elif youbi == 3 :
            print("Saturday")
        elif youbi == 4 :
            print("Sunday")
        elif youbi == 5 :
            print("Monday")
        elif youbi == 6 :
            print("Tuesday")

Python: import sys
 
day = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
num = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
 
for s in sys.stdin:
    M, D = map(int, s.strip().split())
    if M == 0:
        break
    totalDay = D
    M -= 1
 
    while M > 0:
        totalDay += num[M-1]
        M -= 1
 
    print(day[(totalDay+2)%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: # 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])