from random import *
from copy import *
import sys
n = 64
def ur():
    return randint(0,2**64-1)
def urd():
    return randint(1,2**63-1)
def ones(x):
    return bin(x).count('1')
def ur25():
    x = ur()
    return x if ones(x) in range(25,65-25) else ur25()
b32 = 2**32-1
def _xor(reg,i,j):
    reg[i] ^= reg[j]
def _xor32(reg,i,j):
    reg[i] ^= reg[j]&b32
def _and(reg,i,j):
    reg[i] = (reg[i]&reg[j])
def _and32(reg,i,j):
    reg[i] = (reg[i]>>32<<32)^((reg[i]&reg[j])&b32)
def _or(reg,i,j):
    reg[i] = (reg[i]|reg[j])
def _or32(reg,i,j):
    reg[i] = (reg[i]>>32<<32)^((reg[i]|reg[j])&b32)
def _add(reg,i,j):
    reg[i] = (reg[i]+reg[j])%2**64
def _add32(reg,i,j):
    reg[i] = (reg[i]>>32<<32)^((reg[i]+reg[j])&b32)
def _sub(reg,i,j):
    reg[i] = (reg[i]-reg[j]+2**64)%2**64
def _sub32(reg,i,j):
    reg[i] = (reg[i]>>32<<32)^((reg[i]-reg[j]+2**32)&b32)
def generate4():
    reg = [ur(), ur(), ur()]
    oper = [_xor,_xor32,_and,_and32,_or,_or32,_add,_add32,_sub,_sub32]
    # oper = [_xor,_xor32,_add,_add32,_or,_or32]
    # oper = [_add]
    l = []
    last_triple = []
    assert(sum(reg) > 0)
    mistakes = 0
    while len(l) < n:
        r1, r2 = randint(0,2), randint(0,2)
        if len(last_triple):
            r1 = 2
        if r1 == r2:
            continue
        op = oper[randint(0,len(oper)-1)]
        p = sum(reg) > 0
        op(reg,r1,r2)
        ok = True
        if reg[2] in last_triple:
            ok = False
        if ok:
            last_triple += [reg[2]]
            if len(last_triple) == 3:
                l.append(last_triple)
                last_triple = []
        else:
            # return False
            mistakes += 1
        if mistakes > 2**6:
            # print(len(l))
            return False
    assert(len(l) == n)
    again = 0
    for line in l:
        assert(len(line) == 3)
        s = sorted(line)
        if s[0] == s[1] or s[1] == s[2]:
            return False
    return l

for t in range(4,5):
    for nr in range(10):
        print(n)
        arr = []
        if t == 1:
            for i in range(n):
                arr.append([ur(),ur(),ur()])
        if t == 2:
            for i in range(n):
                x = ur25()
                choices = []
                for j in range(64):
                    choices.append(x^(2**j))
                    for w in range(j+1,64):
                        choices.append(x^(2**j)^(2**w))
                a = randint(0,len(choices)-1)
                b = randint(0,len(choices)-1)
                while(a == b):
                    b = randint(0,len(choices)-1)
                arr.append([x,choices[a],choices[b]])
        if t == 3:
            for i in range(8):
                d = urd()
                for j in range(8):
                    a = ur()
                    while a+2*d >= 2**64:
                        a = ur()
                    arr.append([a,a+d,a+2*d])
        if t == 4:
            arr = generate4()
            while not arr:
                arr = generate4()
        if t == 5:
            k = ur()
            while(len(arr) < n):
                a = randint(0,k+1)
                b = randint(0,k+1-a)
                if(k-a-b >= 0):
                    arr.append([a,b,k-a-b])
        for line in arr:
            print(*line)
# print('generation done',file=sys.stderr)


