#include <bits/stdc++.h>
using namespace std;
int b[55] = {0};
int c[55] = {0};
int main() {
  int n;
  cin >> n;
  vector<int> a;
  for (int i = 1; i <= n * n; i++) {
    int h, v;
    cin >> h >> v;
    if (b[h] == 0 && c[v] == 0) {
      a.push_back(i);
      b[h]++;
      c[v]++;
    }
  }
  for (int i = 0; i < a.size(); i++) {
    cout << a[i] << " ";
  }
}
