n = int(input())
c = []
for i in range(n):
  a, b = input().split()
  c.append([i+1, a, -int(b)])

c = sorted(c, key=lambda x: (x[1], x[2]))
for i in c:
  print(i[0]) n = int(input()) n int(input()) int input() input c = [] c [] for i in range(n):
  a, b = input().split()
  c.append([i+1, a, -int(b)]) i range(n) range n a, b = input().split() a input().split() ().split () input split b c.append([i+1, a, -int(b)]) c.append c append [i+1, a, -int(b)] i+1 i 1 a -int(b) int(b) int b c = sorted(c, key=lambda x: (x[1], x[2])) c sorted(c, key=lambda x: (x[1], x[2])) sorted c key=lambda x: (x[1], x[2]) key lambda x: (x[1], x[2]) (x[1], x[2]) x[1] x 1 x[2] x 2 x for i in c:
  print(i[0]) i c print(i[0]) print i[0] i 0 n = int(input()) int(input()) n c = [] [] c c = sorted(c, key=lambda x: (x[1], x[2])) sorted(c, key=lambda x: (x[1], x[2])) c a, b = input().split() input().split() a b = input().split() input().split() b
n = int(input())
c = []
for i in range(n):
  a, b = input().split()
  c.append([i+1, a, -int(b)])

c = sorted(c, key=lambda x: (x[1], x[2]))
for i in c:
  print(i[0])