#include <bits/stdc++.h>
bool hor[51];
bool ver[51];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n * n; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    if (!hor[a] && !ver[b]) {
      hor[a] = ver[b] = true;
      printf("%d\n", i);
    }
  }
}
