object Main {
  import java.util.Scanner

  implicit class RichScanner(sc: Scanner) {
    def readStrings(n: Int): Array[String] = Array.fill(n) { sc.next() }
    def readInts(n: Int): Array[Int] = Array.fill(n) { sc.nextInt() }
    def readLongs(n: Int): Array[Long] = Array.fill(n) { sc.nextLong() }
    def readLineStrings: Array[String] = sc.nextLine().split(' ')
    def readLineInts: Array[Int] = readLineStrings.map(_.toInt)
    def readLineLongs: Array[Long] = readLineStrings.map(_.toLong)
  }

  def main(args: Array[String]): Unit = solve(new Scanner(System.in))

  def solve(sc: Scanner): Unit = {
    val L = sc.nextInt()

    // number of fibres
    val chainLength = (math.log(L) / math.log(2)).toInt

    val fibreLengths = (0 until chainLength).map(i => 1 << i).toArray

    val supplementaryChainLengths = ((chainLength - 1) to 0 by -1)
      .map(i => { (L & (1 << i)) != 0 })
      .map(present => if (present) Some(0) else None)
      .toArray

    // update
    (1 to chainLength).foreach(i => {
      // supplementary path is present
      if (supplementaryChainLengths(i - 1).isDefined) {
        val previousSupplementaryPath = supplementaryChainLengths.slice(0, i - 1).lastIndexWhere(_.isDefined)

        val largestSubpath = if (previousSupplementaryPath != -1) {
          supplementaryChainLengths(previousSupplementaryPath).get + fibreLengths.slice(previousSupplementaryPath + 1, i).sum
        } else {
          fibreLengths.slice(0, i).sum
        }

        supplementaryChainLengths(i - 1) = Some(largestSubpath + 1)
        if (i < chainLength) {
          fibreLengths(i) = largestSubpath + 2
        }
      }
    })

    val N = chainLength + 1
    val M = (N - 1) * 2 + supplementaryChainLengths.count(_.isDefined)
    println(s"$N $M")

    // print main chain
    (0 until chainLength).foreach(i => {
      println(s"${i + 1} ${i + 2} 0")
      println(s"${i + 1} ${i + 2} ${fibreLengths(i)}")
    })

    // print supplementary chain
    (0 until chainLength).foreach(i => {
      if (supplementaryChainLengths(i).isDefined) {
        println(s"1 ${i + 2} ${supplementaryChainLengths(i).get}")
      }
    })
  }
}
