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