from collections import defaultdict def solve(): n = int(input()) ansdict = defaultdict(lambda: True) for i in range(1, n//3+1): for j in range(1, n*2//3): t = tuple(sorted([i, j, n-i-j])) if ansdict[t]: ansdict[t] = False for ans in sorted(list(ansdict.keys())): print(" ".join(map(str, ans))) if __name__=="__main__": solve()