#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  return b == 0 ? a : gcd(b, a % b);
}
struct cmp {
  bool operator()(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
    if (a.first.first < b.first.first)
      return true;
    else if (a.first.first == b.first.first)
      return a.first.second < b.first.second;
    return false;
  }
};
int main() {
  int tc;
  tc = 1;
  int i, n, m, row[55] = {0}, col[55] = {0}, a, b;
  std::vector<int> v;
  while (tc--) {
    scanf("%d", &n);
    for (i = 0; i < n * n; i++) {
      scanf("%d%d", &a, &b);
      if (row[a] == 0 && col[b] == 0) {
        v.push_back(i);
        row[a] = 1;
        col[b] = 1;
      }
    }
    sort(v.begin(), v.end());
    for (i = 0; i < v.size(); i++) {
      printf("%d ", v[i] + 1);
    }
  }
  return 0;
}
