#include <bits/stdc++.h>
using namespace std;
inline void inp(long long int *n) {
  *n = 0;
  char ch = getchar();
  int sign = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') sign = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    *n = (*n << 3) + (*n << 1) + ch - '0', ch = getchar();
  *n = *n * sign;
}
int main() {
  map<int, int> h, vr;
  h.clear();
  vr.clear();
  vector<int> v;
  v.clear();
  int n, x, y;
  scanf("%d", &n);
  int temp = n * n;
  int i = 0;
  while (temp--) {
    i++;
    scanf("%d", &x);
    scanf("%d", &y);
    if (h[x] == 0 && vr[y] == 0) {
      h[x] = 1;
      vr[y] = 1;
      v.push_back(i);
    }
  }
  for (int i = 0; i < v.size(); i++) printf("%d ", v[i]);
  return 0;
}
