N=int(input())
S=[[] for i in range(N)]
for i in range(N):
    s,p=map(str,input().split())
    S[i]=[s,int(p)*(-1),i]

S.sort(key=lambda x:(x[0],x[1]))

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

S.sort(key=lambda x:(x[0],x[1]))

for i in range(N):
    print(S[i][2]+1)