#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, c, n, b[55] = {0}, d[55] = {0};
  cin >> n;
  for (int i = 1; i <= n * n; i++) {
    cin >> a >> c;
    if (!b[a] && !d[c]) cout << i << " ", b[a] = d[c] = 1;
  }
  return 0;
}
