#include <bits/stdc++.h>
using namespace std;
vector<int> v;
int main() {
  int n, x, y;
  cin >> n;
  int a[n], b[n];
  for (int i = 0; i < n; i++) {
    a[i] = 0;
    b[i] = 0;
  }
  for (int i = 0; i < n * n; i++) {
    cin >> x >> y;
    if (a[x - 1] == b[y - 1] && a[x - 1] == 0) {
      a[x - 1] = 1;
      b[y - 1] = 1;
      v.push_back(i + 1);
    }
  }
  for (int i = 0; i < v.size(); i++) cout << v[i] << " ";
}
