#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int i;
  int a[n * n][2];
  for (i = 0; i < n * n; i++) {
    cin >> a[i][0] >> a[i][1];
  }
  int asp1[n];
  int asp2[n];
  fill_n(asp1, n, 0);
  fill_n(asp2, n, 0);
  for (i = 0; i < n * n; i++) {
    if (asp1[a[i][0] - 1] == 0 && asp2[a[i][1] - 1] == 0) {
      cout << i + 1 << " ";
      asp1[a[i][0] - 1] = 1;
      asp2[a[i][1] - 1] = 1;
    }
  }
  cout << endl;
}
