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 = ['a']
R = ['a']
# 何文字目以降を変更するか
for i in range(1, N):
    nr = []
    for r in R:
        for x in X:
            nr.append(r + x)
            if r[-1] == x:
                break
        nr.append(r + chr(ord(r[-1]) + 1))
    R = nr

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