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

s = eval(input())

print((7 - d.index(s)))

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

print((7-y.index(eval(input()))))
d = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]
s = eval(input())
print((7 - d.index(s)))

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

-d = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"] -s = eval(input()) -print((7 - d.index(s))) +y = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"] +print((7 - y.index(eval(input()))))