#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, h, v;
  cin >> n;
  bool a[100] = {0}, s[100] = {0};
  for (int i = 0; i < n * n; i++) {
    cin >> h >> v;
    if (!a[v] && !s[h]) {
      cout << i + 1 << endl;
      a[v] = 1;
      s[h] = 1;
    }
  }
}
