require 'date'

w = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
until (s = gets) == "0 0" do
    m, d = s.split.map(&:to_i)
    c = Date.new(2004, m, d)
    puts w[c.wday]
end