N = int(input())
A = []
for i in range(N):
  S,P = map(str,input().split())
  List = [S,int(P),i+1]
  A.append(List)

sorted_data = sorted(A, key=lambda x:(x[0], -x[1]))

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

sorted_data = sorted(A, key=lambda x:(x[0], -x[1]))

for i in range(len(sorted_data)):
  print(sorted_data[i][2])