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

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

Python: from datetime import datetime

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

while True:
    line = input()
    if line.strip() == '0 0':
        break
    else:
        month, day = map(int, line.strip().split(' '))
        f = '%Y-%m-%d'
        a = datetime.strptime('2004-{}-{}'.format(month, day), f)
        print(youbi[a.weekday()])

Python: from datetime import date
import calendar


while True:
    m,d = map(int,(input().split()))
    if m == 0 and d == 0:
        break
    x = date(2004,m,d).weekday()
    print(["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"][x])

Python: month = [3, 1, 3, 2, 3, 2, 3, 3, 2, 3, 2, 3]

while True:
  m, d = map(int, input().split())
  if m == 0:
    break
  piv = 3
  for i in range(m-1):
    piv += month[i]
  piv += d
  piv %= 7
  if piv == 0:
    print("Sunday")
  elif piv == 1:
    print("Monday")
  elif piv == 2:
    print("Tuesday")
  elif piv == 3:
    print("Wednesday")
  elif piv == 4:
    print("Thursday")
  elif piv == 5:
    print("Friday")
  elif piv == 6:
    print("Saturday")

Python: week = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
days = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
while 1:
    key = 2
    data = list(map(int, input().split()))
    if data[0] == 0 and data[1] == 0:
        break
    month = data[0]
    day = data[1]
    for i in range(month-1):
        key += days[i]
    key += day
    print(week[key % 7])

Python: def day(x,y):
	start=0
	if x==2 or x==8 :
		start=0
	elif x==3 or x==11:
		start=1
	elif x==6:
		start=2
	elif x==9 or x==12:
		start=3
	elif x==1 or x==4 or x==7:
		start=4
	elif x==10:
		start=5
	elif x==5:
		start=6 



	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: 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','Wednewday'][(day%7)-1]

Python: # coding=utf-8

###
### for python program
###

import sys
import math

# math class
class mymath:
    ### pi
    pi = 3.14159265358979323846264338

    ### Prime Number
    def pnum_eratosthenes(self, n):
        ptable = [0 for i in range(n+1)]
        plist = []

        for i in range(2, n+1):
            if ptable[i]==0:
                plist.append(i)
                for j in range(i+i, n+1, i):
                    ptable[j] = 1
        return plist

    def pnum_check(self, n):
        if (n==1):
            return False
        elif (n==2):
            return True
        else:
            for x in range(2,n):
                if(n % x==0):
                    return False
            return True

    ### GCD
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)

    ### LCM
    def lcm(self, a, b):
        return (a*b)//self.gcd(a,b)

    ### Mat Multiplication
    def mul(self, A, B):
        ans = []
        for a in A:
            c = 0
            for j, row in enumerate(a):
                c += row*B[j]
            ans.append(c)
        return ans
    
    ### intチェック
    def is_integer(self, n):
        try:
            float(n)
        except ValueError:
            return False
        else:
            return float(n).is_integer()

    ### 幾何学問題用
    def dist(self, A, B):
        d = 0
        for i in range(len(A)):
            d += (A[i]-B[i])**2            
        d = d**(1/2)
        return d

    ### 絶対値
    def abs(self, n):
        if n >= 0:
            return n
        else:
            return -n

mymath = mymath()

### output class
class output:
    ### list
    def list(self, l):
        l = list(l)
        #print(" ", end="")
        for i, num in enumerate(l):
            print(num, end="")
            if i != len(l)-1:
                print(" ", end="")
        print()

output = output()

### input sample
#i = input()
#N = int(input())
#A, B, C = [x for x in input().split()]
#N, K = [int(x) for x in input().split()]
#inlist = [int(w) for w in input().split()]

#R = float(input())
#A.append(list(map(int,input().split())))

#for line in sys.stdin.readlines():
#    x, y = [int(temp) for temp in line.split()]

#abc list
#abc = [chr(ord('a') + i) for i in range(26)]

### output sample
# print("{0} {1} {2:.5f}".format(A//B, A%B, A/B))
# print("{0:.6f} {1:.6f}".format(R*R*math.pi,R*2*math.pi))
# print(" {}".format(i), end="")

def printA(A):
    N = len(A)
    for i, n in enumerate(A):
        print(n, end='')
        if i != N-1:
            print(' ', end='')
    print()

# リスト内包表記 ifあり
# [x-k if x != 0 else x for x in C]

# ソート（代入する必要なし）
# N.sort()

# 10000個の素数リスト
# P = mymath.pnum_eratosthenes(105000)

def get_input():
    N = []
    while True:
        try:
            N.append(input())
            #N.append(int(input()))
            #N.append(float(input()))
            #N.append([int(x) for x in input().split()])
        except EOFError:
            break
    return N


M = [0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
A = ["Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"]
 
while True:
    m, d = [int(x) for x in input().split()]
    if m==0 and d==0:
        break
    B = (sum(M[:m])+d-1)%7
    print(A[B])