#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  bool *hr = new bool[n];
  bool *hv = new bool[n];
  int i;
  for (i = 0; i < n; i++) {
    hr[i] = false;
    hv[i] = false;
  }
  vector<int> ans;
  for (i = 0; i < n * n; i++) {
    int a, b;
    cin >> a >> b;
    if (!hr[a - 1] && !hv[b - 1]) {
      hr[a - 1] = hv[b - 1] = true;
      ans.push_back(i + 1);
    }
  }
  for (i = 0; i < ans.size(); i++) cout << ans[i] << " ";
}
