#include <bits/stdc++.h>
using namespace std;
int a[55];
int b[55];
int main() {
  memset(a, 0, sizeof(a));
  memset(b, 0, sizeof(b));
  int n;
  scanf("%d", &n);
  int m = n * n;
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (a[x] == 0 && b[y] == 0) {
      a[x] = 1;
      b[y] = 1;
      printf("%d ", i);
    }
  }
  printf("\n");
  return 0;
}
