#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int m = n * n;
  bool h[n + 1], v[n + 1];
  for (int i = 0; i < (n + 1); i++) {
    h[i] = v[i] = 0;
  }
  for (int i = 0; i < m; i++) {
    int hi, vi;
    cin >> hi >> vi;
    if (h[hi] == 0 && v[vi] == 0) {
      h[hi] = 1;
      v[vi] = 1;
      cout << i + 1 << " ";
    }
  }
}
