#include <bits/stdc++.h>
using namespace std;
long long int i, j, n;
int main() {
  cin >> n;
  long long int p = n * n;
  map<long long int, long long int> mx;
  map<long long int, long long int> my;
  vector<long long int> v;
  for (i = 1; i <= p; i++) {
    long long int x, y;
    cin >> x >> y;
    if (mx[x] == 0 && my[y] == 0) {
      mx[x] = 1;
      my[y] = 1;
      v.push_back(i);
    }
  }
  for (i = 0; i < v.size(); i++) {
    cout << v[i] << " ";
  }
  return 0;
}
