#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<bool> u1s;
  vector<bool> u2s;
  u1s.assign(n, false);
  u2s.assign(n, false);
  for (int i = 0; i < n * n; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    if (u1s[x] == false && u2s[y] == false) {
      u1s[x] = true;
      u2s[y] = true;
      cout << i + 1 << " ";
    }
  }
  return 0;
}
