require'date'
Week = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]
while n = gets;
  n = n.split.map(&:to_i)
  break if n[0] == 0
  day = Date::new(2004,n[0],n[1])
  puts Week[day.wday]
end