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:

        mr = max(r)

        for x in X:

            nr.append(r + x)

            if mr == x:

                break

        nr.append(r + chr(ord(mr) + 1))

    R = nr



ans = list(set(R))

ans.sort()

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

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)))}



R = ['a']

for i in range(1, N):

    next_r = []

    for r in R:

        max_s = max(r)

        for x in X[:first_presence[max_s] + 2]:

            next_r.append(r + x)

    R = next_r



ans = R

ans.sort()

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

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:
        mr = max(r)
        for x in X:
            nr.append(r + x)
            if mr == x:
                break
        nr.append(r + chr(ord(mr) + 1))
    R = nr
ans = list(set(R))
ans.sort()
print(*ans, sep="\n")

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)))}
R = ["a"]
for i in range(1, N):
    next_r = []
    for r in R:
        max_s = max(r)
        for x in X[: first_presence[max_s] + 2]:
            next_r.append(r + x)
    R = next_r
ans = R
ans.sort()
print(*ans, sep="\n")

-from itertools import product - -ans = ["a"] -# 何文字目以降を変更するか -    nr = [] +    next_r = [] -        mr = max(r) -        for x in X: -            nr.append(r + x) -            if mr == x: -                break -        nr.append(r + chr(ord(mr) + 1)) -    R = nr -ans = list(set(R)) +        max_s = max(r) +        for x in X[: first_presence[max_s] + 2]: +            next_r.append(r + x) +    R = next_r +ans = R