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)