#include <bits/stdc++.h>
using namespace std;
const int inf = 2147483647, dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1};
const int N = 100005, M = 1000005, mod = 1000000007;
const long long llinf = 9223372036854775807ll;
int n;
pair<string, int> a[105];
map<pair<string, int>, int> mp;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i].first >> a[i].second, mp[a[i]] = i;
  sort(a + 1, a + 1 + n);
  for (int i = 1; i <= n; i++) cout << mp[a[i]] << '\n';
  return 0;
}
