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: import datetime
import sys

week = {0:'Monday', 1:'Tuesday', 2:'Wednesday', 3:'Thursday', 4:'Friday', 5:'Saturday', 6:'Sunday'}

f = sys.stdin
while True:
    month, date = map(int, f.readline().split())
    if month == 0:
        break
    day = datetime.date(2004, month, date)
    print(week[day.weekday()])

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

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

while True:
    m,d = list(map(int,input().split()))
    if m == 0 and d == 0:
        break
    day = 3
    x = 1
    y = 1
    while x != m or y != d:
        if y == month [x]:
            x += 1
            y = 1
        else:
            y += 1
        day += 1
        day %= 7
    print(week [day])

Python: while True:
    a,b=map(int,raw_input().split())
    if a+b==0: break
    kari,day=a,0
    if a>2:
        day+=31+29+b
        kari-=2
        tt = range(1,kari+1)
        for i in tt:
            if kari == 1: break
            if i %2 != 0:
                day+=31
            elif i%2 == 0:
                day+=30
            kari -=1
    else:
        if a == 1:
            day = b
        elif a == 2:
            day = 31+b

    print ['Thursday','Friday','Saturday','Sunday','Monday','Tuesday','Wednesday'][(day%7)-1]

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

Python: accum = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335]
youbi = ["Wednesday", "Thursday", "Friday", "Saturday",
         "Sunday", "Monday", "Tuesday", ]


def getYoubi(month, day):
    total = accum[month - 1] + day
    return youbi[total % 7]


month = 13
day = 32

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

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

import sys
import os
import datetime

DAY_OF_WEEK = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']

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

    if month == 2 and day == 29:
        yday = datetime.date(2014, month, day - 1).timetuple().tm_yday + 1
    elif month == 3:
        yday = datetime.date(2014, month, day).timetuple().tm_yday + 1
    else:
        yday = datetime.date(2014, month, day).timetuple().tm_yday

    a = DAY_OF_WEEK[(3 + yday) % 7]
    print(a)

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

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: import datetime
yobi = {0:"Monday",1:"Tuesday",2:"Wednesday",3:"Thursday",4:"Friday",5:"Saturday",6:"Sunday"}
try:
    while True:
        m, d= map(int, input().split())
        if m == 0 and d == 0 :
            exit()
        day = datetime.datetime.strptime("2004/" + str(m) + "/" + str(d),"%Y/%m/%d")
        if day.weekday() in yobi:
            output = yobi[int(day.weekday())]
            print(output)
except EOFError:
    pass

Python: while True:
    month,day=list(map(int, input().split()))
    if month==day==0:
        break
    month_day=[30,29,31,30,31,30,31,31,30,31,30,31]             #1から12
    tmp_day=0
    for i in range(month-1):
        tmp_day+=month_day[i]
    tmp_day+=day
    amari=tmp_day%7
    if month==day==1:
        print("Thursday")
    elif amari==0:
        print("Thursday")
    elif amari==1:
        print("Friday")
    elif amari==2:
        print("Saturday")
    elif amari==3:
        print("Sunday")
    elif amari==4:
        print("Monday")
    elif amari==5:
        print("Tuesday")
    elif amari==6:
        print("Wednesday")

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 == 7:
           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
from datetime import *

for line in sys.stdin:
    a, b = map(int,line.split())
    try:
        print(date(2004, a, b).strftime("%A"))
    except ValueError:
        break

Python: DAY_OF_WEEK = ['Sunday', 'Monday', 'Tuesday',
               'Wednesday', 'Thursday', 'Friday', 'Saturday']
def day_of_week(y, m, d):
    # ?????\?????????(?????§???????????¬???)
    # ??\?????\???0,????????\???6
    # Zeller's congruence
    if m == 1 or m == 2:
        m += 12
        y -= 1
    h = (y + y // 4 - y // 100 + y // 400 + (13 * m + 8) // 5 + d) % 7
    return h

while True:
    m,d = map(int, input().split())
    if m==0:
        exit()
    print(DAY_OF_WEEK[day_of_week(2004,m,d)])

Python: def day(x,y):
	start=0
	if (x==1 or x==10):
		start=3
	elif (x==2 or x==3 or x==11):
		start=6
	elif (x==4 or x==7):
		start=2
	elif x==5:
		start=4
	elif x==6:
		start=0
	elif x==8:
		start=5
	else:
		start=1
	day=(start+y)%7
	if day==1:
		return "Sunday"
	elif day==2:
		return "Monday"
	elif day==3:
		return "Tuesday"
	elif day==4:
		return "Wednesday"
	elif day==5:
		return "Thursday"
	elif day==6:
		return "Friday"
	else:#0
		return "Saturday"


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

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