require 'date'

wday_list = %w(Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday)

while str = gets
  break if str.to_i == 0
  mon, day = str.split(' ').map(&:to_i)
  date = Date.new(2004, mon, day)
  puts wday_list[date.wday]
end