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

day = (
       'Monday',
       'Tuesday',
       'Wednesday',
       'Thursday',
       'Friday',
       'Saturday',
       'Sunday',
       'Sunday',)
while 1:
    m, d = list(map(int, input().split()))
    if m == 0:
        break
    print(day[date(2004, m, d).weekday()])

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])