def g(n,start,a,b):
    if sum(a)==n:
        b.append(a[:])
        return

    for i in range(start,n+1):
        if sum(a)+i>n:
            break
        a.append(i)
        g(n,i,a,b)
        a.pop()

def p(n):
    b=[]
    g(n,1,[],b)
    b.sort()
    for r in b:
        print(" ".join(map(str,r)))

n=int(input())
p(n)


