<reponame>BACCHUS-S/Baekjoon
import calendar
day = ["MON","TUE","WED","THU","FRI","SAT","SUN"]
a,b=map(int,input().split())
i = calendar.weekday(2007,a,b,)
print(day[i])

import calendar
day = ["MON","TUE","WED","THU","FRI","SAT","SUN"]
a,b=map(int,input().split())
i = calendar.weekday(2007,a,b,)
print(day[i])