#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> a;
  vector<pair<bool, bool> > used(n + 5);
  for (int i = 0; i <= n; i++) used[i] = make_pair(false, false);
  for (int i = 0; i < n * n; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    if (!used[x].first && !used[y].second) {
      a.push_back(i + 1);
      used[x].first = true;
      used[y].second = true;
    }
  }
  sort(a.begin(), a.end());
  for (int i = 0; i < a.size(); i++) printf("%d ", a[i]);
}
