def main(): sa, pa, xa = input().split() sb, pb, xb = input().split() pa = int(pa) pb = int(pb) if pa > pb: print(sa) elif pa < pb: print(sb) else: print(-1) if __name__ == "__main__": main()