N = int(input())

SP = []
for i in range(1,N+1):
  S,P = input().split()
  SP.append([S,-int(P),i])
  
sort_SP = sorted(SP)

for j in sort_SP:
  print(j[2]) N = int(input()) N int(input()) int input() input SP = [] SP [] for i in range(1,N+1):
  S,P = input().split()
  SP.append([S,-int(P),i])
   i range(1,N+1) range 1 N+1 N 1 S,P = input().split() S input().split() ().split () input split P SP.append([S,-int(P),i]) SP.append SP append [S,-int(P),i] S -int(P) int(P) int P i sort_SP = sorted(SP) sort_SP sorted(SP) sorted SP for j in sort_SP:
  print(j[2]) j sort_SP print(j[2]) print j[2] j 2 S,P = input().split() input().split() S sort_SP = sorted(SP) sorted(SP) sort_SP N = int(input()) int(input()) N P = input().split() input().split() P SP = [] [] SP
N = int(input())

SP = []
for i in range(1,N+1):
  S,P = input().split()
  SP.append([S,-int(P),i])
  
sort_SP = sorted(SP)

for j in sort_SP:
  print(j[2])