#include <bits/stdc++.h>
using std::abs;
using std::cerr;
using std::cin;
using std::cout;
using std::endl;
using std::make_pair;
using std::max;
using std::min;
using std::pair;
using std::string;
using std::vector;
template <typename T>
inline T input() {
  T ans;
  cin >> ans;
  return ans;
}
int main() {
  uint32_t n = input<uint32_t>();
  vector<bool> state_horiz(n, false);
  vector<bool> state_vert(n, false);
  bool add_space = false;
  for (uint32_t i = 0; i != n * n; ++i) {
    uint32_t x = input<uint32_t>() - 1;
    uint32_t y = input<uint32_t>() - 1;
    if (not state_horiz[x] and not state_vert[y]) {
      if (add_space) cout << " ";
      add_space = true, cout << i + 1, state_horiz[x] = state_vert[y] = true;
    }
  }
  endl(cout);
  return 0;
}
