

main = do
    let s2i s = (read s) :: Int
    input <- getContents
    let dates = chunksOf3 $ map s2i $ words input
    let f [d,m,a] = diaDeLaSetmana d m a
    let result = map f dates
    mapM_ putStrLn result


chunksOf3 [] = []
chunksOf3 (a:b:c:xs) = [a,b,c]:chunksOf3 xs

