N=int(input())
A = []
for i in range(N):
    s,p = input().split()
    p = int(p)
    A.append((s,p,i+1))
A = sorted(A,key=lambda x:x[1],reverse=True)
A = sorted(A,key=lambda x:x[0])
for i in range(N):
    s,p,k = A[i]
    print(k) N=int(input()) N int(input()) int input() input A = [] A [] for i in range(N):
    s,p = input().split()
    p = int(p)
    A.append((s,p,i+1)) i range(N) range N s,p = input().split() s input().split() ().split () input split p p = int(p) p int(p) int p A.append((s,p,i+1)) A.append A append (s,p,i+1) s p i+1 i 1 A = sorted(A,key=lambda x:x[1],reverse=True) A sorted(A,key=lambda x:x[1],reverse=True) sorted A key=lambda x:x[1] key lambda x:x[1] x[1] x 1 x reverse=True reverse True A = sorted(A,key=lambda x:x[0]) A sorted(A,key=lambda x:x[0]) sorted A key=lambda x:x[0] key lambda x:x[0] x[0] x 0 x for i in range(N):
    s,p,k = A[i]
    print(k) i range(N) range N s,p,k = A[i] s A[i] A i p k print(k) print k A = [] [] A A = sorted(A,key=lambda x:x[0]) sorted(A,key=lambda x:x[0]) A p = input().split() input().split() p p = int(p) int(p) p N=int(input()) int(input()) N p,k = A[i] A[i] p s,p = input().split() input().split() s A = sorted(A,key=lambda x:x[1],reverse=True) sorted(A,key=lambda x:x[1],reverse=True) A s,p,k = A[i] A[i] s k = A[i] A[i] k
N=int(input())
A = []
for i in range(N):
    s,p = input().split()
    p = int(p)
    A.append((s,p,i+1))
A = sorted(A,key=lambda x:x[1],reverse=True)
A = sorted(A,key=lambda x:x[0])
for i in range(N):
    s,p,k = A[i]
    print(k)