#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a, b;
  int boo1[n], boo2[n];
  memset(boo1, 0, sizeof(boo1));
  memset(boo2, 0, sizeof(boo2));
  for (int i = 0; i < n * n; i++) {
    cin >> a >> b;
    if (boo1[a - 1] == 0 && boo2[b - 1] == 0) {
      cout << i + 1 << ' ';
      boo1[a - 1] = 1;
      boo2[b - 1] = 1;
    }
  }
  return 0;
}
