#include <bits/stdc++.h>
using namespace std;
const int N = 100;
int n, x, y, a[N], b[N];
int main() {
  scanf("%d", &n);
  int tot = 1;
  for (int i = 1; i <= n * n; i++) {
    scanf("%d%d", &x, &y);
    if (a[x] | b[y]) continue;
    a[x] = 1;
    b[y] = 1;
    if (tot)
      printf("%d", i);
    else
      printf(" %d", i);
    tot = 0;
  }
  printf("\n");
  return 0;
}
