#include <iostream>
#include <utility>
#include <tuple>
#include <string>
#include <cstdint>
#include <vector>
#include <array>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <cassert>
using namespace std;
using i64 = int64_t;
struct E { int v, w; };
int id(int u) { return 20 - u; }
int l;
vector<E> g[20];
int main() {
    cin >> l;
    for (int u = 19; u > 0; --u) {
        g[u].push_back({ u - 1, 0 });
    }
    for (int i = 0; (1 << (i + 1)) <= l; ++i) {
        g[i + 1].push_back({ i, 1 << i });
    }
    for (int i = 0; i < 19; ++i) {
        if ((l & (1 << i))) {
            int x = l & ~((1 << (i + 1)) - 1);
            if (x != 0) {
                g[19].push_back({ i, x });
            }
        }
    }
    int size = 0;
    for (int u = 0; u < 20; ++u) size += g[u].size();
    cout << 20 << ' ' << size << endl;
    for (int u = 19; u >= 0; --u) {
        for (E e : g[u]) {
            cout << id(u) << ' ' << id(e.v) << ' ' <<  e.w << endl;
        }
    }
    return 0;
}