import sys
input = sys.stdin.readline

N = int(input())

s = [[] for _ in range(N)]
a_ord = ord("a")

for i in range(N):
    if i == 0:
        s[0].append("a")
        continue
    for j in s[i - 1]:
        j_last_ord = ord(j[-1])
        for k in range(a_ord, j_last_ord + 2):
            s[i].append(j + chr(k))

ans = s[-1]
ans.sort()

for i in ans:
    print(i)