#include <bits/stdc++.h>
using namespace std;
#define int long long
struct str {
int x, y, z;
};
signed main() {
cin.tie(0)->sync_with_stdio(0);
int n;
cin >> n;
vector <int> a(n), b(n);
for (int i = 0; i < n; i++) {
cin >> a[i] >> b[i];
}
cout << n - 1 << "\n";
deque <int> xx, yy, zz;
for (int i = 1; i < n; i++) {
xx.push_back(i);
}
for (int i = 0; i + 3 < 2 * n; i++) {
if ((i + 3) % 2 != 0) {
yy.push_back(i + 3);
zz.push_back(i + 3);
}
}
vector <int> x, y, z;
for (int i = 1; i < n; i++) {
if (i % 2 == 1) {
int k = xx.front();
xx.pop_front();
x.push_back(k);
int t = yy.front();
yy.pop_front();
y.push_back(t);
int c = zz.back();
zz.pop_back();
z.push_back(c);
} else {
int k = xx.back();
xx.pop_back();
x.push_back(k);
int t = yy.back();
yy.pop_back();
y.push_back(t);
int c = zz.front();
zz.pop_front();
z.push_back(c);
}
}
for (int i = 0; i < n - 1; i++) {
cout << x[i] << " " << y[i] << " " << z[i] << "\n";
}
}