N = int(input())
X = [chr(ord('a') + i) for i in range(N)]

ans = ['a']
# 何文字目以降を変更するか
for i in range(1, N):
    next_ans = []
    for s in ans:
        max_s = max(s)
        for x in X:
            next_ans.append(s + x)
            if s == x:
                break
        next_ans.append(s + chr(ord(max_s) + 1))
    ans = next_ans

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