a = gets.split b = gets.split if a[1] == b[1] p -1 elsif a[1] > b[1] puts a[0] else puts b[0] end