import Data.Time.Format
import Data.Time.Calendar

getDay :: Int -> Int -> String
getDay m d = formatTime defaultTimeLocale "%A" $ fromGregorian 2004 m d

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