#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, r1, r2;
  while (scanf("%d", &n) != EOF) {
    set<int> myset;
    set<int> miset;
    int count = n * n;
    for (int i = 1; i <= count; i++) {
      scanf("%d %d", &r1, &r2);
      if (myset.count(r1) == 0 && miset.count(r2) == 0) {
        myset.insert(r1);
        miset.insert(r2);
        printf("%d ", i);
      }
    }
    printf("\n");
  }
  return 0;
}
