#include <bits/stdc++.h>
using namespace std;
const int maxn = 2510;
int vis[maxn];
int viz[maxn];
int b[maxn];
int x, y;
int n;
int main() {
  while (scanf("%d", &n) != EOF) {
    memset(vis, 0, sizeof(vis));
    memset(viz, 0, sizeof(viz));
    memset(b, 0, sizeof(b));
    int ans = 0;
    for (int i = 0; i < n * n; i++) {
      scanf("%d %d", &x, &y);
      if (!vis[x] && !viz[y]) {
        vis[x] = 1;
        viz[y] = 1;
        b[ans++] = i + 1;
      }
    }
    printf("%d", b[0]);
    for (int i = 1; i < ans; i++) printf(" %d", b[i]);
    printf("\n");
  }
  return 0;
}
