#include <bits/stdc++.h>
int vi[60], ho[60];
int main() {
  int n, k, i;
  int x, y;
  scanf("%d", &n);
  for (k = 1; k <= n * n; k++) {
    scanf("%d%d", &x, &y);
    if (vi[x] || ho[y]) continue;
    vi[x] = 1;
    ho[y] = 1;
    printf("%d ", k);
  }
}
