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