#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<pair<string, int>> arr;
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    int p;
    cin >> p;
    arr.push_back({s, p});
  }
  vector<pair<string, int>> cpy(arr);
  sort(cpy.begin(), cpy.end(), [](pair<string, int> a, pair<string, int> b) {
    if (a.first == b.first) {
      return a.second < b.second;
    } else {
      return a.first < b.first;
    }
  });
  for (int i = 0; i < n; ++i) {
    cout << (int)(find(arr.begin(), arr.end(), cpy[i]) - arr.begin()) + 1
         << endl;
  }
}
