#include <bits/stdc++.h>
using namespace std;
const int MAX = 55;
int N, a, b, mp[2][MAX];
vector<int> num;
int main(int argc, char** argv) {
  scanf("%d", &N);
  for (int i = (1); i <= (N * N); i++) {
    scanf("%d%d", &a, &b);
    if (mp[0][a] + mp[1][b] == 0) num.push_back(i), mp[0][a] = 1, mp[1][b] = 1;
  }
  for (int i = (0); i < (num.size()); i++) printf("%d ", num[i]);
  printf("\n");
  return 0;
}
