n = [31,29,31,30,31,30,31,31,30,31,30,31]
w = ["Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"]
while gets
  m,d = $_.split.map(&:to_i)
  puts w[(take(m-1).inject(:+)+d)%7] if m != 0
end