require 'date'
table = %w(Sunday Monday Tuesday Wednesday Thursday Friday Saturday)

loop do
  month, day = $<.gets.split.map(&:to_i)
  break if month.zero?
  puts table[Date.new(2004, month, day).wday]
end
