na, pa, ja = input().split() nb, pb, jb = input().split() ans = -1 if len(pa) > len(pb): ans = na elif len(pa) < len(pb): ans = nb else: for i in range(len(pa)): if int(pa[i]) > int(pb[i]): ans = na break elif int(pa[i]) < int(pb[i]): ans = nb break print(ans)