require'date'

Week = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
while(0)
  a = gets;
  num = a.split(" ",2);
  if(num[0].to_i == 0)then
    break;
  end
  day = Date::new(2004,num[0].to_i,num[1].to_i);
  puts Week[day.wday];
end