#include <bits/stdc++.h>
using namespace std;
struct point {
  int x, y;
  point() {}
  point(int a, int b) { x = a, y = b; }
};
template <class T>
T sqr(T a) {
  return a * a;
}
template <class T>
T power(T n, T p) {
  T res = 1;
  for (int i = 0; i < p; i++) res *= n;
  return res;
}
template <class T>
double getdist(T a, T b) {
  return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
template <class T>
T extract(string s, T ret) {
  stringstream ss(s);
  ss >> ret;
  return ret;
}
template <class T>
string tostring(T n) {
  stringstream ss;
  ss << n;
  return ss.str();
}
struct fast {
  fast() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
  }
} cincout;
bool hor[100010], ver[100010];
int main() {
  int n, i, j, x, y;
  cin >> n;
  for (i = 0; i < n * n; i++) {
    cin >> x >> y;
    if (hor[x] || ver[y]) continue;
    hor[x] = ver[y] = 1;
    cout << i + 1 << ' ';
  }
  return 0;
}
