#include <bits/stdc++.h>
using namespace std;
int n, v, h;
map<int, bool> ver;
map<int, bool> hor;
vector<int> res;
int main() {
  cin >> n;
  for (int i = 0; i < n * n; i++) {
    cin >> h >> v;
    if (hor[h] == false && ver[v] == false) {
      res.push_back(i + 1);
      hor[h] = true;
      ver[v] = true;
    }
  }
  for (int i = 0; i < res.size(); i++) cout << res[i] << " ";
  cout << endl;
  return 0;
}
