import sys
sys.setrecursionlimit(10 ** 6)


N = int(input())
ans = []
a = ord('a')


def f(c, A, done):
    global N, a
    if done == N:
        ans.append(''.join(A))
    else:
        B = list(A)
        idx = B.index(0, 0)
        B[idx] = c
        tdone = done + 1
        for i in range(2 ** (N - tdone) - 1, -1, -1):
            k = i
            C = B[:]
            nDone = tdone
            idx = 0
            while k > 0:
                if k & 1 == 1:
                    idx = C.index(0, idx + 1)
                    C[idx] = c
                    nDone += 1
                k >>= 1
            f(chr(ord(c) + 1), tuple(C), nDone)


A = [0] * N
f('a', tuple(A), 0)
ans.sort()
print(*ans, sep='\n')
