#include <bits/stdc++.h>
using namespace std;
bool h[51], v[51];
int i, k, l, m, n, o, p, r;
int main() {
  scanf("%d\n", &n);
  for (int i = 0; i < n * n; i++) {
    scanf("%d %d\n", &l, &r);
    if (h[l] || v[r]) continue;
    h[l] = v[r] = true;
    printf("%d ", i + 1);
  }
  exit(0);
}
