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: lastDayofLastMonth = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335]
dateList = ["Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday"]
inputData = []

while True:
    inputData = list(map(int, input().split()))
    if inputData[0]==0:
        break
    dd_date = lastDayofLastMonth[inputData[0]-1] + inputData[1]
    print(dateList[dd_date%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

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
import sys
i_weekday = { i:weekday for i, weekday in enumerate('Monday Tuesday Wednesday Thursday Friday Saturday Sunday'.split() ) }
while True:
  M, D = map(int, input().split())
  if M == 0:
    sys.exit()
  dt = datetime.datetime.strptime(f'2004-{M}-{D}', '%Y-%m-%d')
  #print(dt)
  print(i_weekday[ dt.weekday() ] )

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