N = int(input())
A = []
for i in range(N):
  a = list(input().split())
  A.append([a[0], -int(a[1]), i+1])
A.sort()
for i in range(N):
  print(A[i][2]) N = int(input()) N int(input()) int input() input A = [] A [] for i in range(N):
  a = list(input().split())
  A.append([a[0], -int(a[1]), i+1]) i range(N) range N a = list(input().split()) a list(input().split()) list input().split() ().split () input split A.append([a[0], -int(a[1]), i+1]) A.append A append [a[0], -int(a[1]), i+1] a[0] a 0 -int(a[1]) int(a[1]) int a[1] a 1 i+1 i 1 A.sort() A.sort A sort for i in range(N):
  print(A[i][2]) i range(N) range N print(A[i][2]) print A[i][2] [i] A i 2 N = int(input()) int(input()) N a = list(input().split()) list(input().split()) a A = [] [] A
N = int(input())
A = []
for i in range(N):
  a = list(input().split())
  A.append([a[0], -int(a[1]), i+1])
A.sort()
for i in range(N):
  print(A[i][2])