#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
  int n;
  while (~scanf("%d", &n)) {
    int color[2][100];
    memset(color, 0, sizeof(color));
    int p = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        int x, y;
        cin >> x >> y;
        p++;
        if (color[0][x] == 0 && color[1][y] == 0) {
          color[0][x] = 1;
          color[1][y] = 1;
          cout << p << " ";
        }
      }
    }
  }
  return 0;
}
