#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<cmath>

using namespace std;

#define rep(i, n) for(long int i = 0; i < n; i++)

struct edge {int from, to, cost;};

int main(){
    int l;
    cin >> l;
    int r = 0;
    int k = l;
    while(k / 2 != 0){
        k /= 2;
        r++;
        
    }
    vector<edge> G;
    k = 1;
    rep(i, r){
        edge g;
        g.from = i + 1;
        g.to = i + 2;
        g.cost = k;
        G.push_back(g);
        g.cost = 0;
        G.push_back(g);
        k *= 2;
    }
    k = 1;
    rep(i, r-1) k *= 2;
    int bi = k * 2;
    // cout << bi << endl;
    for (int i = r; i >= 1; i--){
        if (l - k >= bi){
            edge g;
            g.from = i;
            g.to = r + 1;
            g.cost = l - k;
            G.push_back(g);
            l -= k;
        }
        k /= 2;
    }
    cout << r + 1 << " " << G.size() << endl;
    rep(i, G.size()){
        cout << G[i].from << " " << G[i].to << " " << G[i].cost << endl;
    }
}
