#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  pair<int, int> pp[n * n];
  bool hor[n + 1];
  bool ver[n + 1];
  vector<int> v(n);
  for (int i = 0; i < n + 1; i++) {
    hor[i] = false;
    ver[i] = false;
  }
  int nn = n * n;
  for (int i = 0; i < nn; i++) {
    int x, y;
    cin >> x >> y;
    pp[i] = make_pair(x, y);
  }
  int j = 0;
  for (int i = 0; i < nn; i++) {
    if (hor[pp[i].first] != true && ver[pp[i].second] != true) {
      v[j] = i + 1;
      j++;
      hor[pp[i].first] = true, ver[pp[i].second] = true;
    }
  }
  int l = j;
  for (int i = 0; i < l; i++) cout << v[i] << " ";
  cout << endl;
  return 0;
}
