pl1 = gets.split pl2 = gets.split if pl1[1].to_i < pl2[1].to_i then puts pl2[0] elsif pl2[1].to_i < pl1[1].to_i then puts pl1[0] else puts -1 end