from itertools import* r=id(0)%3 for t in combinations(range(1,(8,6,14)[r]),r+2+r/2*8):print' '.join(map(str,t))