days = [
       "Thursday",
       "Friday",
       "Saturday",
       "Sunday",
       "Monday",
       "Tuesday",
       "Wednesday"
       ]

cal = take 366 $ cycle days

endOfTheMonth = [31,29,31,30,31,30,31,31,30,31,30,31]

main = do
    l <- getLine
    if l == "0 0"
      then return ()
      else do
        let [a, b] = map (read :: String -> Int) $ words l
        let s = sum $ take (a - 1) endOfTheMonth
        let s' = s + b - 1
        putStrLn $ cal !! s'
        main