
from yogi import *


for d in tokens(int):
    m = read(int)
    a = read(int)
    print(day_of_the_week(d, m, a))
