require 'time'

intToDay = ["Sunday",
            "Monday",
             "Tuesday",
            "Wednesday",
           "Thursday",
            "Friday",
           "Saturday"]
loop do
  data = gets.split.map(&:to_i)
  break if data[0] == 0
  puts intToDay[Date.new(2004,data[0],data[1]).wday]
end