#include <iostream>
#include <vector>
using namespace std;

int main() 
{
	int n;
	cin >> n;
	vector< vector<int> > a (n, vector<int>(n, 0));
	
	bool first = true;
	
	for (int d = 0; d < n * n; ++d)
	{
		int row, col;
		cin >> row >> col;
		--row;
		--col;
		if (a[row][col] == 0)
		{
			if (first)
				first = false;
			else
				cout << " ";
				
			cout << d + 1;
			
			for (int c = 0; c < n; ++c)
				a[row][c] = 1;
			for (int r = 0; r < n; ++r)
				a[r][col] = 1;			
		}

	}
	

	
	return 0;
	
}