Start: Jun, 26, 2019 08:30:00
2019年度暑期短学期第一天
End: Jun, 26, 2019 11:30:00
Time elapsed:
Time remaining:

Problem_ID: C
Result: Accepted
Time: 133ms
Memory: 24448kB
Author: 2017212304053
In contest: 1273

while True:
    try:
        y,m,d=map(int,input().split())
        #c=y//100
        #y=y%100
        if m==1 or m==2:
            y-=1
            m+=12
        #w=(int(c/4)-2*c+y+int(y/4)+int((13*(m+1))/5)+d-1)%7
        w=(d+2*m+3*(m+1)//5+y+y//4-y//100+y//400)%7+1
        if w==1:
            p='Monday'
        if w==2:
            p='Tuesday'
        if w==3:
            p='Wednesday'
        if w==4:
            p='Thursday'
        if w==5:
            p='Friday'
        if w==6:
            p='Saturday'
        if w==7:
            p='Sunday'
        print(p)
    except EOFError:
        break