#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, h, v;
  set<int> horizontal;
  set<int> vertical;
  vector<int> days;
  scanf("%d", &n);
  for (int i = 0; i < n * n; i++) {
    scanf("%d %d", &h, &v);
    if (horizontal.find(h) == horizontal.end() &&
        vertical.find(v) == vertical.end()) {
      days.push_back(i + 1);
      horizontal.insert(h);
      vertical.insert(v);
    }
  }
  for (int i = 0; i < days.size(); i++) {
    if (i) printf(" ");
    printf("%d", days[i]);
  }
  printf("\n");
  return 0;
}
