N = int(input())
L = []
for i in range(N):
  a, b = input().split()
  L.append([i+1, a, int(b)])
L.sort(key=lambda List:(List[1], -List[2]))
for l in L:
  print(l[0]) N = int(input()) N int(input()) int input() input L = [] L [] for i in range(N):
  a, b = input().split()
  L.append([i+1, a, int(b)]) i range(N) range N a, b = input().split() a input().split() ().split () input split b L.append([i+1, a, int(b)]) L.append L append [i+1, a, int(b)] i+1 i 1 a int(b) int b L.sort(key=lambda List:(List[1], -List[2])) L.sort L sort key=lambda List:(List[1], -List[2]) key lambda List:(List[1], -List[2]) (List[1], -List[2]) List[1] List 1 -List[2] List[2] List 2 List for l in L:
  print(l[0]) l L print(l[0]) print l[0] l 0 N = int(input()) int(input()) N L = [] [] L b = input().split() input().split() b a, b = input().split() input().split() a
N = int(input())
L = []
for i in range(N):
  a, b = input().split()
  L.append([i+1, a, int(b)])
L.sort(key=lambda List:(List[1], -List[2]))
for l in L:
  print(l[0])