#include <bits/stdc++.h>

using namespace std;
typedef pair<int,int> pii;
typedef long long int ll;

#define INF 1 << 30
#define REP(i,n) for(ll i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(ll i=(k);i<(int)(n);i++)
int l;
int r;
vector<pii> v;

int main(){
  cin >> l;
  r = log2(l);
  int n = r+1;
  int m = 2*r;
  l -= pow(2,r);
  int node = n-1;
  int len = pow(2,r);
  while(l > 0 && node > 0){
    //cout << node <<endl;
    if(l>=pow(2,node-1)){
      v.push_back(pii(node,len));
      m++;
      l -= pow(2,node-1);
      len += pow(2,node-1);
    }
    node--;
  }
  cout << n << " " << m <<endl;
  REP(i,n-1){
    cout << i+1 << " " << i+2 << " " << pow(2,i) << endl;
    cout << i+1 << " " << i+2 << " " << 0 << endl;
  }
  for(int i = 0; i < v.size();i++){
    cout << v[i].first << " " << n << " " << v[i].second << endl;
  }
}
