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