#include <bits/stdc++.h>   using namespace std;   int main() {     bool v[60], h[60];     int a, b, n;     while (cin >> n) {       memset(v, false, sizeof(v));       memset(h, false, sizeof(h));       for (int i = 1; i <= n * n; i++) {         cin >> a >> b;         if (i == 1) {           cout << 1;           h[a] = true;           v[b] = true;         } else if (h[a] == false && v[b] == false) {           h[a] = true;           v[b] = true;           cout <<     << i;         }       }       cout << endl;     }     return 0;   }   