a1,b1,c1=input().split() a2,b2,c2=input().split() b1,b2=int(b1),int(b2) if b1==b2: print(-1) elif b1>b2: print(a1) else: print(a2)