output_description: Print N lines. The i-th line (1 ≤ i ≤ N) should contain the identification
  number of the restaurant that is introduced i-th in the book.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      S_1 P_1
      :
      S_N P_N
attempt: N = int(input())
  S = [""] * N
  P_s = [""] * N
  P = [0] * N
  Idx = [0] * N
  
  for i in range(N):
      S[i], P_s[i] = map(str, input().split())
      P[i] = int(P_s[i])
      Idx[i] = i
  
  m_i = 0
  m_p = -1
  for i in range(N - 1):
      for j in range(i, N):
          if m_p < P[j]:
              m_i = j
              m_p = P[j]
      tmp = P[i]
      P[i] = P[m_i]
      P[m_i] = tmp
      tmp_s = S[i]
      S[i] = S[m_i]
      S[m_i] = tmp_s
      tmp_i = Idx[i]
      Idx[i] = Idx[m_i]
      Idx[m_i] = tmp_i
      m_p = -1
  
  for i in range(0, N - 1):
      for j in range(1, N - i):
          if S[j] < S[j - 1]:
              tmp = P[j]
              P[j] = P[j - 1]
              P[j - 1] = tmp
              tmp_s = S[j]
              S[j] = S[j - 1]
              S[j - 1] = tmp_s
              tmp_i = Idx[j]
              Idx[j] = Idx[j - 1]
              Idx[j - 1] = tmp_i
  
  
  for i in range(N):
      print(Idx[i] + 1)
  
problem_description: Statement
  
  You have decided to write a book introducing good restaurants. There are N
  restaurants that you want to introduce: Restaurant 1, Restaurant 2, ...,
  Restaurant N. Restaurant i is in city S_i, and your assessment score of that
  restaurant on a 100-point scale is P_i. No two restaurants have the same
  score.
  
  You want to introduce the restaurants in the following order:
  
    * The restaurants are arranged in lexicographical order of the names of their cities.
    * If there are multiple restaurants in the same city, they are arranged in descending order of score.
  
  Print the identification numbers of the restaurants in the order they are
  introduced in the book.
samples: [{"input": "6\n    khabarovsk 20\n    moscow 10\n    kazan 50\n    kazan 35\n    moscow 60\n    khabarovsk 40", "output": "3\n    4\n    6\n    1\n    5\n    2\n    \n\nThe lexicographical order of the names of the three cities is `kazan` <\n`khabarovsk` < `moscow`. For each of these cities, the restaurants in it are\nintroduced in descending order of score. Thus, the restaurants are introduced\nin the order 3,4,6,1,5,2.\n\n* * *"}, {"input": "10\n    yakutsk 10\n    yakutsk 20\n    yakutsk 30\n    yakutsk 40\n    yakutsk 50\n    yakutsk 60\n    yakutsk 70\n    yakutsk 80\n    yakutsk 90\n    yakutsk 100", "output": "10\n    9\n    8\n    7\n    6\n    5\n    4\n    3\n    2\n    1"}]