p1 = input().split() p2 = input().split() if int(p1[1]) > int(p2[1]): print(p1[0]) elif int(p1[1]) < int(p2[1]): print(p2[0]) else: print(-1)