import sys sys.set_int_max_str_digits(0) sa, pa, xa = input().split() sb, pb, xb = input().split() pa, pb = int(pa), int(pb) if pa > pb: print(sa) elif pa < pb: print(sb) else: print(-1)