A, B, C = input().split() D, E, F = input().split() B = int(B) E = int(E) if B > E: print(A) elif B < E: print(D) else: print(-1)