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