N=int(input())
x=[]
for i in range(N):
    S,P=map(str,input().split())
    x.append([S,int(P),i+1])
X=sorted(x,key=lambda x:(x[0],-x[1]))
for i in range(N):
    print(X[i][2]) N=int(input()) N int(input()) int input() input x=[] x [] for i in range(N):
    S,P=map(str,input().split())
    x.append([S,int(P),i+1]) 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([S,int(P),i+1]) x.append x append [S,int(P),i+1] S int(P) int P i+1 i 1 X=sorted(x,key=lambda x:(x[0],-x[1])) X sorted(x,key=lambda x:(x[0],-x[1])) sorted x key=lambda x:(x[0],-x[1]) key lambda x:(x[0],-x[1]) (x[0],-x[1]) x[0] x 0 -x[1] x[1] x 1 x for i in range(N):
    print(X[i][2]) i range(N) range N print(X[i][2]) print X[i][2] [i] X i 2 x=[] [] x X=sorted(x,key=lambda x:(x[0],-x[1])) sorted(x,key=lambda x:(x[0],-x[1])) X S,P=map(str,input().split()) map(str,input().split()) S N=int(input()) int(input()) N P=map(str,input().split()) map(str,input().split()) P
N=int(input())
x=[]
for i in range(N):
    S,P=map(str,input().split())
    x.append([S,int(P),i+1])
X=sorted(x,key=lambda x:(x[0],-x[1]))
for i in range(N):
    print(X[i][2])