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)