N=int(input())
li=[]
for i in range(N):
    a,b=input().split()
    b=int(b)
    li.append([a,100-b,i+1])
li.sort()

for j in range(N):
    print(li[j][2]) N=int(input()) N int(input()) int input() input li=[] li [] for i in range(N):
    a,b=input().split()
    b=int(b)
    li.append([a,100-b,i+1]) i range(N) range N a,b=input().split() a input().split() ().split () input split b b=int(b) b int(b) int b li.append([a,100-b,i+1]) li.append li append [a,100-b,i+1] a 100-b 100 b i+1 i 1 li.sort() li.sort li sort for j in range(N):
    print(li[j][2]) j range(N) range N print(li[j][2]) print li[j][2] [j] li j 2 b=int(b) int(b) b b=input().split() input().split() b a,b=input().split() input().split() a N=int(input()) int(input()) N li=[] [] li
N=int(input())
li=[]
for i in range(N):
    a,b=input().split()
    b=int(b)
    li.append([a,100-b,i+1])
li.sort()

for j in range(N):
    print(li[j][2])
