#include <bits/stdc++.h>
using namespace std;
int i, j, k, n, h, v, l;
int checkh[55];
int checkv[55];
int road[2505][4];
int main(void) {
  cin >> n;
  k = 1;
  for (i = 1; i <= n; i++) {
    checkh[i] = 0;
    checkv[i] = 0;
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      scanf("%d%d", &h, &v);
      road[k][0] = h;
      road[k][1] = v;
      k++;
    }
  }
  k = 1;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      h = road[k][0];
      v = road[k][1];
      if (checkh[h] == 0 && checkv[v] == 0) {
        checkh[h] = 1;
        checkv[v] = 1;
        printf("%d ", k);
      }
      k++;
    }
  }
  printf("\n");
  return 0;
}
