#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<tuple<string, int, int>> A(N);
  
  for (int i = 0; i < N; i++){
    string S;
    int P;
    cin >> S >> P;
    A.at(i) = make_tuple(S, 100-P, i+1);
  }
  