#include <bits/stdc++.h>
using namespace std;
int main(){
cin.tie(0);
ios::sync_with_stdio(0);
int n;
cin >> n;
vector<pair<int, int>> strings(n);
for(int i = 0; i < n; i++){
cin >> strings[i].first >> strings[i].second;
}
sort(strings.begin(), strings.end());
int restrings = n - 1;
if(n % 2 == 0) restrings--;
cout << restrings << "\n";
int l = 1;
int r = n - 1;
while(l < r){
int lstart = (2 * l + 1);
int lend = (2 * n) - (2 * (l - 1)) - 1;
int rstart = (2 * r) + 1;
int rend = (2 * l) + 1;
cout << l << " " << lstart << " " << lend << "\n";
cout << r << " " << rstart << " " << rend << "\n";
l++;
r--;
}
}