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