#include <iostream>
#include <vector>
#include <algorithm>
#include <array>
#include <iterator>
#include <string>
#include <cctype>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <ctime>
#include <iomanip>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <bitset>
#include <random>
#include <utility>
#include <functional>
using namespace std;
void Main()
{
	int N;
	cin >> N;
	const long long M = (long long)5e17;
	vector<long long> A(N),B(N);
	for(int i = 0;i < N;i++)
	{
		cin >> A[i] >> B[i];
	}
	vector<int> ord(N);
	iota(ord.begin(),ord.end(),0);
	sort(ord.begin() + 1,ord.end(),[&](int i,int j)
	{
		return max(abs(A[i] - M),abs(B[i] - M)) > max(abs(A[j] - M),abs(B[j] - M));
	});
	vector<pair<int,int>> ans;
	for(int i = 1;i < N;i++)
	{
		ans.push_back(make_pair(1,ord[i] + 1));
	}
	cout << ans.size() << "\n";
	for(int i = 0;i < (int)ans.size();i++)
	{
		cout << ans[i].first << " " << ans[i].second << "\n";
	}
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int tt = 1;
	/* cin >> tt; */
	while(tt--) Main();
}