n = int(input())

lets = [chr(i) for i in range(ord("a"), ord("a") + n)]

d = {e: i for i, e in enumerate(lets)}



s = ["a"]

for i in range(1, n):

    nxt = []

    for e in s:

        mx = 0

        for l in e:

            mx = max(mx, d[l])

        for j in range(mx + 2):

            nxt.append(e + lets[j])

    s = nxt



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

n = int(input())



lets = [chr(i) for i in range(ord("a"), ord("z") + 1)]

ans = []





def dfs(s, l, mx):

    if l == n:

        ans.append(s)

        return



    for i in range(mx + 2):

        dfs(s + lets[i], l + 1, max(mx, i))





dfs("", 0, -1)

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

n = int(input())
lets = [chr(i) for i in range(ord("a"), ord("a") + n)]
d = {e: i for i, e in enumerate(lets)}
s = ["a"]
for i in range(1, n):
    nxt = []
    for e in s:
        mx = 0
        for l in e:
            mx = max(mx, d[l])
        for j in range(mx + 2):
            nxt.append(e + lets[j])
    s = nxt
print(*s, sep="\n")

n = int(input())
lets = [chr(i) for i in range(ord("a"), ord("z") + 1)]
ans = []


def dfs(s, l, mx):
    if l == n:
        ans.append(s)
        return
    for i in range(mx + 2):
        dfs(s + lets[i], l + 1, max(mx, i))


dfs("", 0, -1)
print(*ans, sep="\n")

-lets = [chr(i) for i in range(ord("a"), ord("a") + n)] -d = {e: i for i, e in enumerate(lets)} -s = ["a"] -for i in range(1, n): -    nxt = [] -    for e in s: -        mx = 0 -        for l in e: -            mx = max(mx, d[l]) -        for j in range(mx + 2): -            nxt.append(e + lets[j]) -    s = nxt -print(*s, sep="\n") +lets = [chr(i) for i in range(ord("a"), ord("z") + 1)] +ans = [] + + +def dfs(s, l, mx): +    if l == n: +        ans.append(s) +        return +    for i in range(mx + 2): +        dfs(s + lets[i], l + 1, max(mx, i)) + + +dfs("", 0, -1) +print(*ans, sep="\n")