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: w = ["Wednesday", "Thursday", "Friday",
     "Saturday", "Sunday", "Monday", "Tuesday"]
a = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
while 1:
    m, d = map(int, input().split())
    if m == 0:
        break
    s = 0
    for i in range(m - 1):
        s += a[i]

    print(w[(s+d) % 7])

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 + 2) % 7])

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

Python: while 1:
    m,d = map(int,input().split())
    if m == 0:
        break
    w = ["Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"]
    day = [0,31,60,91,121,152,182,213,244,274,305,335]
    print(w[(day[m-1]+d)%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 - 2 * 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 == 2:
        print("Tuesday")
    elif You == 3:
        print("Monday")
    elif You == 4:
        print("Wednesday")
    elif You == 5:
        print("Thursday")
    elif You == 6:
        print("Friday")
    elif You == 0:
        print("Saturday")

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


m, d = [int(i) for i in input().split()]
while m != 0:
    sum = 0
    for i in range(0, m - 1):
        sum += month[i]
    sum += d
    print(day[sum % 7])
    m, d = [int(i) for i in input().split()]

Python: from datetime import date
DOTW = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
while True :
    try :
        month,day = [int(_) for _ in input().split()]
        print(DOTW[date(2004,month,day).weekday()])
    except : break

Python: import datetime
while True:
    m, d = map(int, raw_input().split())
    if m == 0 and d == 0:
        break
    print ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'][datetime.date(2004, m, d).weekday()]

Python: from datetime import datetime
r=[]
while 1:
    l=list(map(int,input().split()))
    if not l[0] and not l[1]:break
    r.extend([datetime(year=2004,month=l[0],day=l[1]).weekday()])
for i in r:
    if i==0:print("Monday")
    elif i==1:print("Tuesday")
    elif i==2:print("Wednesday")
    elif i==3:print("Thursday")
    elif i==4:print("Friday")
    elif i==5:print("Saturday")
    elif i==6:print("Sunday")

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 == 0:
           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

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


def getPNoD(n):
  if n == 1:
    return 0
  elif n == 3:
    return 29 + getPNoD(n-1)
  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: days = [31,29,31,30,31,30,31,31,30,31,30,31]
ans = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]

while True:
    idx = 3
    m,d = map(int, input().split())
    if m==0: break
    print(ans[(idx+sum(days[:m-1])+d-1)%7])

Python: from datetime import datetime

y = 2004

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

    day = datetime(y, m, d)
    print(day.strftime('%A'))

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
        print(date)
        k=(date+y)%7
        print(date+y)
        print(lis[k])
    else:
        break

Python: from datetime import date
import calendar

while True:
    m, d = map(int, input().split())
    if not m:
        break
    print(calendar.day_name[date(2004, 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}
while True:
    m, d = map(int, input().split())
    if m == 0:
        break
    days = month[m] + d
    print(week[days % 7])

Python: while True:
    m, d = map(int, input().split())
    if m == d == 0:
        break
    dim = {1: 0, 2: 31, 3: 60, 4: 91, 5: 121, 6: 152, 7: 182, 8: 213, 9: 244, 10: 274, 11: 305, 12: 335}
    ds = dim[m] + d -1
    print({0:'Thursday', 1:'Friday', 2:'Saturday', 3:'Sunday', 4:'Monday', 5:'Tuesday', 6:'Wednesday'}[ds % 7])

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

import sys
import os
import datetime

DAY_OF_WEEK = ['Thursday', 'Friday', 'Saturday', 'Sunday', 'Monday', 'Tuesday', 'Wednesday']
MONTH = [0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

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

    past_day = sum(MONTH[:month]) + day - 1

    a = past_day % 7
    print(DAY_OF_WEEK[a])

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

Python: month = [31, 30, 29, 30, 31, 30, 31, 31, 30, 31, 30, 31]
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])