#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string> 
#include <iomanip>
#include <list>
#include <random>
#include <numeric> //iota - iota(v.begin(), v.end(), x) x, x + 1, x + 2...

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef int INT;
#define int ll
#define mmin(a, b) a = min(a, b)
#define mmax(a, b) a = max(a, b)
#define all(a) a.begin(),a.end()
#define sz(a) ((int)(a.size()))
#define watch(x) cout << (#x) << " = " << x << endl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pii> vpi;

/*
tuple<int, string> f() {
return {485, "Hello"};
}
int a;
string b;
tie(a, b) = f();
*/

const double PI = 2 * acos(0.0), eps = 1e-8;
const int oo = 1e15;

template<class T>
void show(const vector<T> &a) {
	cout << sz(a) << endl;
	for (T x : a)
		cout << x << " ";
	cout << endl;
}

const ll M = 998244353;

ll MOD(ll a) {
	if (a >= 0) return a >= M ? a % M : a;
	if (a <= -M) a %= M;
	return a ? a + M : a;
}

int gcd(int a, int b)
{
	while (a > 0)
	{
		if (a < b)
			swap(a, b);
		a %= b;
	}
	return b;
}


/*______________________________________________________________________________________________________________________________
________________________________________________________________________________________________________________________________
________________________________________________________________________________________________________________________________
________________________________________________________________________________________________________________________________
________________________________________________________________________________________________________________________________
________________________________________________________________________________________________________________________________
________________________________________________________________________________________________________________________________
________________________________________________________________________________________________________________________________
________________________________________________________________________________________________________________________________
______________________________________________________________________________________________________________________________*/


#define N 3001



signed main() 
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int L;
	cin >> L;
	int step = 0, x = 2;
	while (x <= L)
	{
		x *= 2;
		step++;
	}
	int y = 1 << step;
	vector <pair <pii, int> > edges;
	int u = 1;
	for (int i = 0; i < step; i++)
	{
		edges.push_back({ { i, i + 1 }, 0 });
		edges.push_back({ { i, i + 1 }, u });
		u *= 2;
	}

	L -= y;
	while (L != 0)
	{
		if (L == 1)
		{
			edges.push_back({ { 0, step }, y });
			break;
		} 
		int st = 0, xx = 2;
		while (xx <= L)
		{
			xx *= 2;
			st++;
		}
		edges.push_back({ { st, step }, y });
		y += (1 << st);
		L -= (1 << st);
	}

	cout << step + 1 << " " << edges.size() << endl;
	for (int i = 0; i < edges.size(); i++)
	{
		cout << edges[i].first.first + 1 << " " << edges[i].first.second + 1 << " " << edges[i].second << endl;
	}

}


Measured memory_bytes: 256