sa, pa, xa=input().split() sb, pb, xb=input().split() pa=int(pa) pb=int(pb) ans=None if pa==pb: ans=-1 elif pa>pb: ans=sa else: ans=sb print(ans)