#include <bits/stdc++.h>
using namespace std;
bool b[3000], b1[3000];
int main() {
  int n, c = 1;
  pair<int, int> pa[3000];
  cin >> n;
  for (int i = 0; i < n * n; i++) {
    cin >> pa[i].first >> pa[i].second;
  }
  for (int i = 0; i < n * n; i++) {
    if ((!b[pa[i].first] && !b1[pa[i].second])) {
      b[pa[i].first] = 1;
      b1[pa[i].second] = 1;
      cout << c << " ";
    }
    c++;
  }
}
