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