from itertools import product
N = int(input())
X = [chr(ord('a') + i) for i in range(N)]
first_presence = {x: i for x, i in zip(X, list(range(N)))}

ans = []
# 何文字目以降を変更するか
for i in range(1, N + 1):
    can_use = X[:i]
    s = ''.join(can_use)
    for pattern in product(can_use, repeat=N - i):
        ans.append(s + ''.join(pattern))


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