wdays = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ] 
answers = Array.new
while line = $stdin.gets
	yymm = line.chomp.split(/\s/).map{|n| n.to_i}
	break if yymm[ 0 ] == 0 
	day = Time.local( 2004, yymm[ 0 ], yymm[ 1 ], 0,0,0)
	answers << day.wday
end
answers.each{ |a| puts wdays[ a ] }
