N=int(input())
ls1=[]
for i in range(N):
    si,pi=input().split()
    pi2=int(pi)
    ls2=[si,pi2,i+1]
    ls1.append(ls2)
ls1.sort(key=lambda x:-x[1])   
ls1.sort(key=lambda x:x[0])
for i in range(N):
    print(ls1[i][2]) N=int(input()) N int(input()) int input() input ls1=[] ls1 [] for i in range(N):
    si,pi=input().split()
    pi2=int(pi)
    ls2=[si,pi2,i+1]
    ls1.append(ls2) i range(N) range N si,pi=input().split() si input().split() ().split () input split pi pi2=int(pi) pi2 int(pi) int pi ls2=[si,pi2,i+1] ls2 [si,pi2,i+1] si pi2 i+1 i 1 ls1.append(ls2) ls1.append ls1 append ls2 ls1.sort(key=lambda x:-x[1]) ls1.sort ls1 sort key=lambda x:-x[1] key lambda x:-x[1] -x[1] x[1] x 1 x ls1.sort(key=lambda x:x[0]) ls1.sort ls1 sort key=lambda x:x[0] key lambda x:x[0] x[0] x 0 x for i in range(N):
    print(ls1[i][2]) i range(N) range N print(ls1[i][2]) print ls1[i][2] [i] ls1 i 2 ls2=[si,pi2,i+1] [si,pi2,i+1] ls2 N=int(input()) int(input()) N si,pi=input().split() input().split() si pi2=int(pi) int(pi) pi2 pi=input().split() input().split() pi ls1=[] [] ls1
N=int(input())
ls1=[]
for i in range(N):
    si,pi=input().split()
    pi2=int(pi)
    ls2=[si,pi2,i+1]
    ls1.append(ls2)
ls1.sort(key=lambda x:-x[1])   
ls1.sort(key=lambda x:x[0])
for i in range(N):
    print(ls1[i][2])