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