#include <bits/stdc++.h>
void run() {
  int n;
  std::cin >> n;
  int curr;
  std::array<std::array<int, 50>, 50> arr{0};
  int day = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      day++;
      int row, col;
      std::cin >> row >> col;
      row--;
      col--;
      if (arr[row][col] == 0) {
        for (int k = 0; k < n; k++) {
          arr[row][k] = 1;
          arr[k][col] = 1;
        }
        std::cout << day << " ";
      }
    }
  }
}
int main() {
  run();
  return 0;
}
