print('\n'.join(map(str, (x[2]+1 for x in sorted((s, -int(p), i) for i, (s, p) in enumerate(zip(*[iter(open(0).read().split()[1:])]*2))))))) x[2]+1 for x in sorted((s, -int(p), i) for i, (s, p) in enumerate(zip(*[iter(open(0).read().split()[1:])]*2))) for x in sorted((s, -int(p), i) for i, (s, p) in enumerate(zip(*[iter(open(0).read().split()[1:])]*2))) x sorted((s, -int(p), i) for i, (s, p) in enumerate(zip(*[iter(open(0).read().split()[1:])]*2))) sorted (s, -int(p), i) s -int(p) int(p) int p i for x in sorted((s, -int(p), i) for i, (s, p) in enumerate(zip(*[iter(open(0).read().split()[1:])]*2))) x[2]+1 x[2] x 2 1 print('\n'.join(map(str, (x[2]+1 for x in sorted((s, -int(p), i) for i, (s, p) in enumerate(zip(*[iter(open(0).read().split()[1:])]*2))))))) print '\n'.join(map(str, (x[2]+1 for x in sorted((s, -int(p), i) for i, (s, p) in enumerate(zip(*[iter(open(0).read().split()[1:])]*2)))))) '\n'.join '\n' join map(str, (x[2]+1 for x in sorted((s, -int(p), i) for i, (s, p) in enumerate(zip(*[iter(open(0).read().split()[1:])]*2))))) map str (x[2]+1 for x in sorted((s, -int(p), i) for i, (s, p) in enumerate(zip(*[iter(open(0).read().split()[1:])]*2))))
print('\n'.join(map(str, (x[2]+1 for x in sorted((s, -int(p), i) for i, (s, p) in enumerate(zip(*[iter(open(0).read().split()[1:])]*2)))))))