#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n;
int w[N], h[N];
int main() {
  vector<pair<int, int> > V;
  cin >> n;
  for (int i = 0; i < n * n; i++) {
    int x, y;
    cin >> x >> y;
    V.push_back({x, y});
  }
  int cnt = 0;
  for (int i = 0; i < n * n; i++) {
    if (w[V[i].first] == 0 && h[V[i].second] == 0) {
      w[V[i].first] = h[V[i].second] = 1;
      printf("%d ", i + 1);
    }
  }
  return 0;
}
