#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n * n], b[n * n], i, j;
  for (i = 0; i < n * n; i++) {
    cin >> a[i] >> b[i];
  }
  std::vector<int> v;
  v.push_back(1);
  unordered_set<int> s, s1;
  s.insert(a[0]);
  s1.insert(b[0]);
  for (i = 1; i < n * n; i++) {
    if (s.find(a[i]) == s.end()) {
      if (s1.find(b[i]) == s1.end()) {
        v.push_back(i + 1);
        s.insert(a[i]);
        s1.insert(b[i]);
      }
    }
  }
  for (i = 0; i < v.size(); i++) {
    cout << v[i] << " ";
  }
}
