#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  int row[n * n];
  int col[n * n];
  int rdone[n];
  int cdone[n];
  int i = 0, j = 0, k = 0;
  for (i = 0; i < n * n; i++) {
    scanf("%d", &row[i]);
    scanf("%d", &col[i]);
  }
  for (i = 0; i < n * n; i++) {
    for (j = 0; j < k; j++) {
      if (row[i] == rdone[j] || col[i] == cdone[j]) {
        break;
      }
    }
    if (j == k) {
      printf("%d ", i + 1);
      rdone[k] = row[i];
      cdone[k] = col[i];
      k++;
    }
  }
  return 0;
}
