n = int(input())
l = []
d = {}
for i in range(n):
  s,p = input().split()
  if s not in l:
    l.append(s)
    d[s] = []
  d[s].append([int(p), i+1])

for i in sorted(l):
  for j in sorted(d[i], reverse=True):
    print(j[1]) n = int(input()) n int(input()) int input() input l = [] l [] d = {} d {} for i in range(n):
  s,p = input().split()
  if s not in l:
    l.append(s)
    d[s] = []
  d[s].append([int(p), i+1]) i range(n) range n s,p = input().split() s input().split() ().split () input split p if s not in l:
    l.append(s)
    d[s] = []
   s not in l s l l.append(s) l.append l append s d[s] = [] d[s] d s [] d[s].append([int(p), i+1]) [s].append [s] d s append [int(p), i+1] int(p) int p i+1 i 1 for i in sorted(l):
  for j in sorted(d[i], reverse=True):
    print(j[1]) i sorted(l) sorted l for j in sorted(d[i], reverse=True):
    print(j[1]) j sorted(d[i], reverse=True) sorted d[i] d i reverse=True reverse True print(j[1]) print j[1] j 1 n = int(input()) int(input()) n d = {} {} d p = input().split() input().split() p s,p = input().split() input().split() s l = [] [] l
n = int(input())
l = []
d = {}
for i in range(n):
  s,p = input().split()
  if s not in l:
    l.append(s)
    d[s] = []
  d[s].append([int(p), i+1])

for i in sorted(l):
  for j in sorted(d[i], reverse=True):
    print(j[1])