#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int h[55], v[55], x, y, i, n;
  cin >> n;
  n *= n;
  for (i = 0; i < 55; i++) h[i] = v[i] = 0;
  for (i = 0; i < n; i++) {
    cin >> x >> y;
    if (!h[x] && !v[y]) {
      h[x] = v[y] = 1;
      cout << i + 1 << " ";
    }
  }
  cout << "\n";
  return 0;
}
