#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> ans;
map<int, int> vis1, vis2;
int main() {
  scanf("%d", &n);
  for (int i = 1, u, v; i <= n * n; i++) {
    scanf("%d%d", &u, &v);
    if (vis1[u] || vis2[v]) continue;
    vis1[u] = vis2[v] = 1;
    ans.push_back(i);
  }
  printf("%d", ans[0]);
  for (int i = 1; i < ans.size(); i++) printf(" %d", ans[i]);
  return 0;
}
