import Control.Applicative

dayCount (x:xs) = do
  let day = case x of 0 -> 0
                      1 -> 0 + head xs
                      2 -> 31 + head xs
                      3 -> 60 + head xs
                      4 -> 91 + head xs
                      5 -> 121 + head xs
                      6 -> 152 + head xs
                      7 -> 182 + head xs
                      8 -> 213 + head xs
                      9 -> 244 + head xs
                      10 -> 274 + head xs
                      11 -> 305 + head xs
                      12 -> 335 + head xs
  if day == 0
    then putStr ""
    else case mod day 7 of 0 -> putStrLn "Wednesday"
                           1 -> putStrLn "Thursday"
                           2 -> putStrLn "Friday"
                           3 -> putStrLn "Saturday"
                           4 -> putStrLn "Sunday"
                           5 -> putStrLn "Monday"
                           6 -> putStrLn "Tuesday"


main = do
  input <- fmap (fmap (read :: String -> Int) . words) . lines <$> getContents
  mapM_ dayCount input