while gets
  month,day = $_.chomp.split.map {|x| x.to_i}
  break if month == 0 && day == 0
  from_shougatu = day
  month -= 1
  while month > 0
    case month
    when 1,3,5,7,8,10,12
      from_shougatu += 31
    when 4,6,9,11
      from_shougatu += 30
    when 2
      from_shougatu += 29
    end
    month -= 1
  end
  which_day = ["Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"]
  puts which_day[from_shougatu%7]
end