N=int(input())
S=[""]*N
T=[""]*N
for i in range(N):
  S[i]=list(input().split())
  S[i][1]=-int(S[i][1])
  T[i]=S[i]
S.sort(key=lambda x:(x[0],x[1]))
for i in range(N):
  for j in range(N):
      if(T[j]==S[i]):
        print(j+1) N=int(input()) N int(input()) int input() input S=[""]*N S [""]*N [""] "" N T=[""]*N T [""]*N [""] "" N for i in range(N):
  S[i]=list(input().split())
  S[i][1]=-int(S[i][1])
  T[i]=S[i] i range(N) range N S[i]=list(input().split()) S[i] S i list(input().split()) list input().split() ().split () input split S[i][1]=-int(S[i][1]) S[i][1] [i] S i 1 -int(S[i][1]) int(S[i][1]) int S[i][1] [i] S i 1 T[i]=S[i] T[i] T i S[i] S 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):
  for j in range(N):
      if(T[j]==S[i]):
        print(j+1) i range(N) range N for j in range(N):
      if(T[j]==S[i]):
        print(j+1) j range(N) range N if(T[j]==S[i]):
        print(j+1) T[j]==S[i] T[j] T j S[i] S i print(j+1) print j+1 j 1 N=int(input()) int(input()) N S=[""]*N [""]*N S T=[""]*N [""]*N T
N=int(input())
S=[""]*N
T=[""]*N
for i in range(N):
  S[i]=list(input().split())
  S[i][1]=-int(S[i][1])
  T[i]=S[i]
S.sort(key=lambda x:(x[0],x[1]))
for i in range(N):
  for j in range(N):
      if(T[j]==S[i]):
        print(j+1)