#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<bool> h(n + 1), v(n + 1);
  for (int i = 1; i <= n * n; i++) {
    int a, b;
    cin >> a >> b;
    if (!h[a] && !v[b]) {
      cout << i << " ";
      h[a] = 1;
      v[b] = 1;
    }
  }
  return 0;
}
