import sys
sys.setrecursionlimit(10 ** 6)


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


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



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