#include <bits/stdc++.h>
using namespace std;
bool vis[2][60];
int main() {
  int n;
  cin >> n;
  n *= n;
  bool flag = 0;
  for (int i = 1; i <= n; i++) {
    int t1, t2;
    cin >> t1 >> t2;
    if (!vis[0][t1] && !vis[1][t2]) {
      vis[0][t1] = vis[1][t2] = 1;
      if (flag) cout << " ";
      cout << i;
      flag = 1;
    }
  }
}
