#include <bits/stdc++.h>
const double PI = acos(-1.0);
const double e = exp(1.0);
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class T>
inline T Min(T a, T b) {
  return a < b ? a : b;
}
template <class T>
inline T Max(T a, T b) {
  return a > b ? a : b;
}
bool cmpbig(int a, int b) { return a > b; }
bool cmpsmall(int a, int b) { return a < b; }
using namespace std;
int ans[300];
int h[55], v[55];
int main() {
  int n;
  while (~scanf("%d", &n)) {
    int k = n * n, j = 0;
    memset(h, 0, sizeof(h));
    memset(v, 0, sizeof(v));
    for (int i = 1; i <= k; i++) {
      int a, b;
      scanf("%d%d", &a, &b);
      if (h[a] == 0 && v[b] == 0) {
        h[a] = 1;
        v[b] = 1;
        ans[j] = i;
        j++;
      }
    }
    printf("%d", ans[0]);
    for (int i = 1; i < j; i++) {
      printf(" %d", ans[i]);
    }
    printf("\n");
  }
  return 0;
}
