S = eval(input())



L = [ "SUN","MON","TUE","WED","THU","FRI","SAT" ]

L.reverse()



ans = 0

for i in range(len(L)):

    if S == L[i]:

        ans = i + 1

        break

print(ans)
w=['SUN','MON','TUE','WED','THU','FRI','SAT']

S=eval(input())

i=w.index(S)

print((7 if i==0 else 7-i))
S = eval(input())
L = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]
L.reverse()
ans = 0
for i in range(len(L)):
    if S == L[i]:
        ans = i + 1
        break
print(ans)

w = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]
S = eval(input())
i = w.index(S)
print((7 if i == 0 else 7 - i))

+w = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"] -L = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"] -L.reverse() -ans = 0 -for i in range(len(L)): -    if S == L[i]: -        ans = i + 1 -        break -print(ans) +i = w.index(S) +print((7 if i == 0 else 7 - i))