N=int(input())
num=[i for i in range(1,N+1)]
X=[]

for i in range(N):
    S,P=map(str,input().split())
    X.append([num[i],S,int(P)])

X = sorted(X,key=lambda d:d[2],reverse=True)
X = sorted(X,key=lambda d:d[1])

for i in X:
    print(i[0]) N=int(input()) N int(input()) int input() input i for i in range(1,N+1) for i in range(1,N+1) i range(1,N+1) range 1 N+1 N 1 for i in range(1,N+1) i num=[i for i in range(1,N+1)] num [i for i in range(1,N+1)] X=[] X [] for i in range(N):
    S,P=map(str,input().split())
    X.append([num[i],S,int(P)]) i range(N) range N S,P=map(str,input().split()) S map(str,input().split()) map str input().split() ().split () input split P X.append([num[i],S,int(P)]) X.append X append [num[i],S,int(P)] num[i] num i S int(P) int P X = sorted(X,key=lambda d:d[2],reverse=True) X sorted(X,key=lambda d:d[2],reverse=True) sorted X key=lambda d:d[2] key lambda d:d[2] d[2] d 2 d reverse=True reverse True X = sorted(X,key=lambda d:d[1]) X sorted(X,key=lambda d:d[1]) sorted X key=lambda d:d[1] key lambda d:d[1] d[1] d 1 d for i in X:
    print(i[0]) i X print(i[0]) print i[0] i 0 S,P=map(str,input().split()) map(str,input().split()) S num=[i for i in range(1,N+1)] [i for i in range(1,N+1)] num X=[] [] X X = sorted(X,key=lambda d:d[1]) sorted(X,key=lambda d:d[1]) X X = sorted(X,key=lambda d:d[2],reverse=True) sorted(X,key=lambda d:d[2],reverse=True) X N=int(input()) int(input()) N P=map(str,input().split()) map(str,input().split()) P
N=int(input())
num=[i for i in range(1,N+1)]
X=[]

for i in range(N):
    S,P=map(str,input().split())
    X.append([num[i],S,int(P)])

X = sorted(X,key=lambda d:d[2],reverse=True)
X = sorted(X,key=lambda d:d[1])

for i in X:
    print(i[0])