N = int(input())
M = {}
S = set()
for i in range(N):
	s, p = input().split()
	if s in M:
		t = M[s]
		t.append((int(p), i + 1))
	else:
		t = []
		t.append((int(p), i + 1))
		M[s] = t		
	S.add(s)

for s in sorted(S):
	for t2 in (sorted(M[s], reverse = True)):
		print(t2[1])
	 N = int(input()) N int(input()) int input() input M = {} M {} S = set() S set() set for i in range(N):
	s, p = input().split()
	if s in M:
		t = M[s]
		t.append((int(p), i + 1))
	else:
		t = []
		t.append((int(p), i + 1))
		M[s] = t		
	S.add(s) i range(N) range N s, p = input().split() s input().split() ().split () input split p if s in M:
		t = M[s]
		t.append((int(p), i + 1))
	else:
		t = []
		t.append((int(p), i + 1))
		M[s] = t		
	 s in M s M t = M[s] t M[s] M s t.append((int(p), i + 1)) t.append t append (int(p), i + 1) int(p) int p i + 1 i 1 t = [] t [] t.append((int(p), i + 1)) t.append t append (int(p), i + 1) int(p) int p i + 1 i 1 M[s] = t M[s] M s t S.add(s) S.add S add s for s in sorted(S):
	for t2 in (sorted(M[s], reverse = True)):
		print(t2[1])
	 s sorted(S) sorted S for t2 in (sorted(M[s], reverse = True)):
		print(t2[1])
	 t2 sorted(M[s], reverse = True) sorted M[s] M s reverse = True reverse True print(t2[1]) print t2[1] t2 1 s, p = input().split() input().split() s t = M[s] M[s] t S = set() set() S t = [] [] t M = {} {} M N = int(input()) int(input()) N p = input().split() input().split() p
N = int(input())
M = {}
S = set()
for i in range(N):
	s, p = input().split()
	if s in M:
		t = M[s]
		t.append((int(p), i + 1))
	else:
		t = []
		t.append((int(p), i + 1))
		M[s] = t		
	S.add(s)

for s in sorted(S):
	for t2 in (sorted(M[s], reverse = True)):
		print(t2[1])
	
