#include <bits/stdc++.h>
using namespace std;
int main() {
  int tc, h, j, m = 0;
  cin >> tc;
  int a[2505];
  int x[2505] = {0};
  int y[2505] = {0};
  for (int i = 1; i <= tc * tc; i++) {
    cin >> h >> j;
    if (!x[h] and !y[j]) {
      a[m++] = i;
      x[h] = y[j] = 1;
    }
  }
  for (int i = 0; i < m; i++) {
    cout << a[i] << " ";
  }
  return 0;
}
