require 'date'

class Whatday
  def self.date(m, d)
    Date::DAYNAMES[Date.new(2004, m, d).wday]
  end
end

STDIN.read.split("\n").each do |line|
  m, d = line.split.map(&:to_i)
  break if m.zero?
  puts Whatday.date(m, d)
end