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: from datetime import date
days = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]

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

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

Python: import datetime

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

while True:
  m, d = raw_input().rstrip().split(" ")
  if int(m) == 0 and int(d) == 0: break
  print(l[datetime.date(2004, int(m), int(d)).weekday()])

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

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

Python: def solve():
    day = [
        'Wednesday',
        'Thursday',
        'Friday',
        'Saturday',
        'Sunday',
        'Monday',
        'Tuesday',
    ]
    
    days_month = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
    days_total = []
    for i in range(len(days_month)):
        days_total.append(sum(days_month[0:i]))
    
    while True:
        mm, dd = map(int, input().split())
        if mm == 0 and dd == 0:
            break
        
        numd = days_total[mm - 1]
        total = numd + dd
        idx = total % len(day)
        
        print(day[idx])
    

if __name__ == "__main__":
    solve()

Python: from datetime import date

if __name__ == '__main__':
    while True:
        # ??????????????\???
        month, day = [int(x) for x in input().split(' ')]
        if month == 0:
            break

        # ?????\????¨??????¨???????????????
        dt = date(2004, month, day)
        print(dt.strftime('%A'))

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

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

while True:
    m, d = map(int, input().split())
    if m == 0 or d == 0:
        break
    days = 0
    for month in range(0, m-1):
        days += days_in_month[month]
    days += d + 2
    days %= 7
    print(day[days])

Python: day = (
       'Thursday',
       'Friday',
       'Saturday', # 2
       'Sunday',
       'Monday', # 4
       'Tuesday',
       'Wednesday',
)
mm = {1:0,
      2:3,
      3:4,
      4:5,
      5:3,
      6:5,
      7:0,
      8:3,
      9:6,
      10:1,
      11:4,
      12:6,
      }
while 1:
    m, d = list(map(int, input().split()))
    if m == 0:
        break
    print(day[(mm[m] + d - 1)%7])

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 x==1 or 3 or 5 or 7 or 8 or 10 or 12 :
                date += 31
            elif x==2:
                date +=29
            else:
                date+=30
        k=(date+y)%7
        print(lis[k])
    else:
        break

Python: from datetime import *
for e in iter(input,'0 0'):print(date(2004,*map(int,e.split())).strftime('%A'))

Python: for e in iter(input,'0 0'):
 m,d=map(int,e.split())
 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: 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", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday"]

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

Python: from datetime import date

while True:
    m, d = map(int, input().split())
    if (m, d) == (0, 0):
        break
    weeks = {1:'Monday',2:'Tuesday',3:'Wednesday',4:'Thursday',5:'Friday',6:'Saturday',7:'Sunday'}
    w = date.isoweekday(date(2004, m, d))
    print(weeks[w])

Python: import datetime

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

    print(dt.strftime('%A'))

Python: import datetime
for e in iter(input,'0 0'):print(datetime.date(2004,*map(int,e.split())).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 6 or 9 or 11):
                date=date+30
            elif i==2:
                date =date+29
            else:
                date=date+31
        k=(date+y)%7
        print(lis[k])
    else:
        break