from itertools import product
N = int(input())

c = [chr(97 + i) for i in range(N)]

ans = []
for i in range(1, N):
    S = c[:i]
    tmp = [1] * i
    add = N - i
    for p in product(range(N - i + 1), repeat=i):
        if sum(p) == add:
            letter = ""
            for j in range(i):
                letter += S[j] * (tmp[j] + p[j])
            ans.append(letter)
ans.append("".join(c[:N]))

print(*ans, sep="\n")
