import Data.Time

getDay :: Int -> Int -> String
getDay m d
    | delta == 0 = "Thursday"
    | delta == 1 = "Friday"
    | delta == 2 = "Saturday"
    | delta == 3 = "Sunday"
    | delta == 4 = "Monday"
    | delta == 5 = "Tuesday"
    | otherwise  = "Wednesday"
    where delta = (fromGregorian 2004 m d `diffDays` fromGregorian 2004 1 1) `mod` 7

main :: IO ()
main = interact $ unlines . map (\[m, d] -> getDay m d) . map (map read) . map words . takeWhile (/= "0 0") . lines