#include <iostream>
#include <algorithm>
#include <map>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <iomanip>
using namespace std;

using int64 = long long;
using uint64 = unsigned long long;

#define repeat(i, x) for (int64 i = 0; (i) < (x); (i)++)
#define rev_repeat(i, x) for (int64 i = (x) - 1; (i) >= 0; (i)--)
#define countup(i, n) for (int64 i = 0; (i) <= (n); (i)++)
#define countdown(i, n) for (int64 i = (n); (i) >= 0; (i)--)
#define range(i, a, b) for (int64 i = (a); (i) < (b); (i)++)
#define traverse(it, ctn) for (auto it = begin(ctn); (it) != end(ctn); (it)++)
#define rev_traverse(it, ctn) for (auto it = rbegin(ctn); (it) != rend(ctn); (it)++)

template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec)
{
    os << "[";
    repeat (i, vec.size())
    {
        os << (i == 0 ? "" : ", ") << vec[i];
    }
    os << "]";
    return os;
}

template<typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& p)
{
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

template<typename T>
ostream& operator<<(ostream& os, set<T>& s)
{
    os << "{";
    traverse (it, s)
    {
        if (it != s.begin()) os << ", ";
        os << *it;
    }
    os << "}";
    return os;
}

template<typename K, typename V>
ostream& operator<<(ostream& os, map<K, V>& m) 
{
    os << "{";
    traverse (it, m)
    {
        if (it != m.begin()) os << ", ";
        os << it->first << ": " << it->second;
    }
    os << "}";
    return os;
}

//
// _______  _____  _______  _____  _______ _______ _____ _______ _____ _    _ _______ 
// |       |     | |  |  | |_____] |______    |      |      |      |    \  /  |______ 
// |_____  |_____| |  |  | |       |______    |    __|__    |    __|__   \/   |______ 
//
//  _____   ______  _____   ______  ______ _______ _______ _______ _____ __   _  ______   /
// |_____] |_____/ |     | |  ____ |_____/ |_____| |  |  | |  |  |   |   | \  | |  ____  / 
// |       |    \_ |_____| |_____| |    \_ |     | |  |  | |  |  | __|__ |  \_| |_____| .  
//

string toBinary(int n)
{
    if (n <= 1) return to_string(n);
    return toBinary(n / 2) + to_string(n % 2);
}

int main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int L;
    cin >> L;

    L--;

    int x = 0;
    while (L >= (1 << x)) { x++; }

    int n = x + 1,
        m = (x - 1) * 2 + 1;
    for (char d : toBinary(L))
    {
        if (d == '1')
        {
            m++;
        }
    }

    if (L == 1)
    {
        cout << 2 << " " << 2 << endl;
        cout << 1 << " " << 2 << " " << 0 << endl;
        cout << 1 << " " << 2 << " " << 1 << endl;
        return 0;
    }

    cout << n - 1 << " " << m - 1 << endl;

    // 構築
    for (int u = 2; u + 1 <= n; u++)
    {
        cout << u - 1 << " " << u << " " << "0" << endl;
        cout << u - 1 << " " << u << " " << (1 << (n - (u + 1))) << endl;
    }
    // cout << 1 << " " << 2 << " " << 0 << endl;

    string bin = toBinary(L);
    reverse(bin.begin(), bin.end());

    int sum = 0;
    for (int i = bin.size() - 1; i >= 0; i--)
    {
        if (bin[i] == '0') continue;

        // 最初じゃないときは張る
        if (i != bin.size() - 1)
        {
            cout << 1 << " " << (1 + (bin.size() - 1) - i) << " " << sum << endl;
        }
        sum += (1 << i);
    }

    if (bin.back() == '1')
    {
        cout << 1 << " " << n - 1 << " " << sum << endl;
    }

    return 0;
}


Measured memory_bytes: 256