#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  vector<int> v;
  cin >> n;
  n *= n;
  int a[n + 5], b[n + 5];
  int a1[n + 5], b1[n + 5];
  memset(a1, 0, sizeof a1);
  memset(b1, 0, sizeof b1);
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    if (a1[a[i]] == 0 && b1[b[i]] == 0) {
      a1[a[i]] = 1;
      b1[b[i]] = 1;
      v.push_back(i + 1);
    }
  }
  for (int i = 0; i < v.size(); i++) {
    cout << v[i];
    if (i < v.size() - 1) cout << " ";
  }
  cout << "\n";
  return 0;
}
