S = str(eval(input()))

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

if S == "SUN" :

	print((7))

else :

	print((7 - week.index(S) - 1))
S = str(eval(input()))

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

print((7 - week.index(S)))
S = str(eval(input()))
week = ["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"]
if S == "SUN":
    print((7))
else:
    print((7 - week.index(S) - 1))

S = str(eval(input()))
week = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]
print((7 - week.index(S)))

-week = ["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"] -if S == "SUN": -    print((7)) -else: -    print((7 - week.index(S) - 1)) +week = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"] +print((7 - week.index(S)))