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