#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <climits>
#include <queue>
#include <fstream>
#include <sstream>
#include <math.h>
#include <list>
using namespace std;
using ll = long long;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<vector<int>> kupac(10000);
int cur = 1;
for (size_t i = 0; i < n; i++)
{
kupac[0].push_back(i);
}
for (size_t i = 0; i < n; i++)
{
if (kupac[cur].size() < kupac[0].size()) {
int movedIdx = kupac[0][kupac[0].size() - 1];
kupac[cur].push_back(movedIdx);
kupac[0].pop_back();
cout << 1 << " " << 0 << " " << cur << "\n";
}
else {
cur++;
i--;
}
}
int sum = 0;
for (int i = cur; i > 1; i--)
{
int number = kupac[i].size();
sum += number;
cout << sum << " " << i << " " << i-1 << "\n";
}
}