#include<iostream>
#include<cmath>
#include<vector>
using namespace std;

int main(){
	int L;
	cin >> L;
	int r=(int) log2(L);
	int N=r+1;
	vector<int> v,u,w;
	for(int i=1;i<N;i++){	
		v.push_back(i);
		u.push_back(i+1);
		w.push_back(0);
		v.push_back(i);
		u.push_back(i+1);
		w.push_back(pow(2,i-1));
	}
	for(int i=N-1;i>0;i--){
		if(L-pow(2,i-1)>=pow(2,r)){
			v.push_back(i);
			u.push_back(N);
			w.push_back(L-pow(2,i-1));
			L-=pow(2,i-1);
		}
	}
	cout << N << ' ' << v.size() << endl;
	for(int i=0;i<v.size();i++){
		cout << v[i] << ' ' << u[i] << ' ' << w[i] << endl;
	}
}
