#include <bits/stdc++.h>
using namespace std;
const int maxi = 5e6 + 1;
int main() {
  int n, a, b;
  cin >> n;
  set<int> stA, stB;
  vector<int> V;
  n *= n;
  for (int i = 1; i <= n; i++) {
    cin >> a >> b;
    if (stA.find(a) == stA.end() && stB.find(b) == stB.end()) {
      stA.insert(a);
      stB.insert(b);
      V.push_back(i);
    }
  }
  for (auto x : V) cout << x << ' ';
  return 0;
}
