#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
  int n, h, v, size = 0;
  cin >> n;
  vector<bool> horizontal(n), vertical(n);
  vector<int> days;
  for (int i = 0; i < n * n; i++) {
    cin >> h >> v;
    if (!horizontal[h - 1] && !vertical[v - 1]) {
      horizontal[h - 1] = vertical[v - 1] = true;
      days.push_back(i + 1);
      size++;
    }
  }
  for (int i = 0; i < size; i++) cout << days[i] << " ";
  return 0;
}
