#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(container) container.begin(), container.end()
#define Cin(T, x) T x; cin >> x;
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i];
#define Cout(val) cout << (val) << "\n";
using namespace std;
using ll = long long;

int main(void){
    Cin(int, l);
    vector<int> bits;
    while(l){
        bits.push_back(l & 1);
        l >>= 1;
    }
    int n = (int)bits.size();
    int m = 2*(n-1) + accumulate(Range(bits), -1);
    printf("%d %d\n", n, m);
    
    for(int i = 1; i < n; i ++){
        printf("%d %d 0\n", i, i+1);
        printf("%d %d %d\n", i, i+1, 1 << (i-1));
    }
    int need = 1 << (n-1);
    for(int i = n-1; i > 0; i --){
        if(bits[i-1] == 0) continue;
        printf("%d %d %d\n", i, n, need);
        need += 1 << (i-1);
    }
}

