#include <bits/stdc++.h>
using namespace std;
int a[52][52], b[5200];
int main() {
  int n, x, y;
  cin >> n >> x >> y;
  a[x][y] = 1;
  b[1] = 1;
  int falg = 0;
  int hhh = 0;
  for (int i = 2; i <= n * n; i++) {
    cin >> x >> y;
    for (int j = 1; j <= n; j++) {
      if (a[j][y] == 1) {
        falg = 1;
        break;
      }
    }
    for (int j = 1; j <= n; j++) {
      if (a[x][j] == 1) {
        hhh = 1;
        break;
      }
    }
    if (hhh == 0 && falg == 0) {
      a[x][y] = 1;
      b[i] = 1;
    } else {
      b[i] = 0;
      hhh = 0;
      falg = 0;
    }
  }
  for (int i = 1; i <= n * n; i++) {
    if (b[i] == 1) cout << i << " ";
  }
  cout << endl;
  return 0;
}
