N = int(input())
SP = []
idx = 1

for _ in range(N):
	S, P = input().split()
	SP.append([idx, S, int(P)])
	idx += 1

SP.sort(key = lambda x:(x[1], -x[2]))

for i in range(N):
	print(SP[i][0]) N = int(input()) N int(input()) int input() input SP = [] SP [] idx = 1 idx 1 for _ in range(N):
	S, P = input().split()
	SP.append([idx, S, int(P)])
	idx += 1 _ range(N) range N S, P = input().split() S input().split() ().split () input split P SP.append([idx, S, int(P)]) SP.append SP append [idx, S, int(P)] idx S int(P) int P idx += 1 idx 1 SP.sort(key = lambda x:(x[1], -x[2])) SP.sort SP sort key = lambda x:(x[1], -x[2]) key lambda x:(x[1], -x[2]) (x[1], -x[2]) x[1] x 1 -x[2] x[2] x 2 x for i in range(N):
	print(SP[i][0]) i range(N) range N print(SP[i][0]) print SP[i][0] [i] SP i 0 SP = [] [] SP N = int(input()) int(input()) N idx = 1 1 idx idx += 1 1 idx S, P = input().split() input().split() S P = input().split() input().split() P
N = int(input())
SP = []
idx = 1

for _ in range(N):
	S, P = input().split()
	SP.append([idx, S, int(P)])
	idx += 1

SP.sort(key = lambda x:(x[1], -x[2]))

for i in range(N):
	print(SP[i][0])