#include <bits/stdc++.h>
const int N = 50 + 5;
int n, h, v, bo_h[N * N], bo_v[N * N];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n * n; ++i) {
    scanf("%d%d", &h, &v);
    if (bo_h[h] || bo_v[v]) continue;
    bo_h[h] = bo_v[v] = 1;
    printf("%d ", i);
  }
  return 0;
}
