#include <bits/stdc++.h>
using namespace std;
int main() {
  bool H[50], V[50];
  int n, h, v, cnt = 0;
  vector<int> a;
  for (int i = (0); i < (50); i++) {
    H[i] = true;
    V[i] = true;
  }
  cin >> n;
  for (int i = (1); i < (n * n + 1); i++) {
    cin >> h >> v;
    h--;
    v--;
    if (H[h] && V[v]) {
      H[h] = false;
      V[v] = false;
      a.push_back(i);
      cnt += 1;
    }
  }
  for (int i = (0); i < (cnt - 1); i++) cout << a[i] << " ";
  cout << a[cnt - 1] << endl;
  return 0;
}
