#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int L;
  cin >> L;
  int n2 = 2;
  int keta = 1;
  while (n2 <= L) {
    n2 = n2 * 2;
    keta++;
  }
  vector<bool> t2(keta,false);
  int num1 = -3;
  for (int i=0; i<keta; i++) {
    if (L%2 == 1) {
      t2[keta-1-i] = true;
      num1++;
    }
    L = L/2;
  }
  int maxx = n2/4;
  cout << keta << ' ' << keta * 2 + num1 << endl;
  int i = 1;
  while (maxx != 0) {
    cout << i << ' ' << i+1 << ' ' << maxx << endl;
    cout << i << ' ' << i+1 << ' ' << 0 << endl;
    maxx = maxx/2;
    i++;
  }
  int size = n2/2;
  n2 = size/2;
  for (int i=1; i<keta; i++) {
    if (t2[i]) {
      cout << 1 << ' ' << i+1 << ' ' << size << endl;
      size += n2;
    }
    n2 = n2 / 2;
  }
}