from collections import deque

N = int(eval(input()))



alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]

unvisited = deque(alphabet[0 : N])

visited = deque()

st = deque([["a", visited, unvisited]]) # stack



while len(st) > 0:

    str, visited, unvisited = st.popleft()



    if str[-1] not in visited:

        visited.append(str[-1])

        unvisited.popleft()



    if len(str) == N:

        print(str)

    else:

        # すでに使った文字を使う

        for x in visited:

            st.append([str + x, deque(visited), deque(unvisited)])

        # まだ使っていない文字を使う

        if len(unvisited) > 0:

            x = unvisited[0]

            st.append([str + x, deque(visited), deque(unvisited)])

from collections import deque

N = int(eval(input()))



alphabet = "abcdefghij"

visited = 1

st = deque([["a", visited]])



while len(st) > 0:

    str, visited = st.popleft()



    if len(str) == N:

        print(str)

    else:

        # すでに使った文字を使う

        for x in alphabet[0 : visited]:

            st.append([str + x, visited])

        # まだ使っていない文字を使う

        # len(str) < Nだから、visited < N

        st.append([str + alphabet[visited], visited + 1])

from collections import deque

N = int(eval(input()))
alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]
unvisited = deque(alphabet[0:N])
visited = deque()
st = deque([["a", visited, unvisited]])  # stack
while len(st) > 0:
    str, visited, unvisited = st.popleft()
    if str[-1] not in visited:
        visited.append(str[-1])
        unvisited.popleft()
    if len(str) == N:
        print(str)
    else:
        # すでに使った文字を使う
        for x in visited:
            st.append([str + x, deque(visited), deque(unvisited)])
        # まだ使っていない文字を使う
        if len(unvisited) > 0:
            x = unvisited[0]
            st.append([str + x, deque(visited), deque(unvisited)])

from collections import deque

N = int(eval(input()))
alphabet = "abcdefghij"
visited = 1
st = deque([["a", visited]])
while len(st) > 0:
    str, visited = st.popleft()
    if len(str) == N:
        print(str)
    else:
        # すでに使った文字を使う
        for x in alphabet[0:visited]:
            st.append([str + x, visited])
        # まだ使っていない文字を使う
        # len(str) < Nだから、visited < N
        st.append([str + alphabet[visited], visited + 1])

-alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"] -unvisited = deque(alphabet[0:N]) -visited = deque() -st = deque([["a", visited, unvisited]])  # stack +alphabet = "abcdefghij" +visited = 1 +st = deque([["a", visited]]) -    str, visited, unvisited = st.popleft() -    if str[-1] not in visited: -        visited.append(str[-1]) -        unvisited.popleft() +    str, visited = st.popleft() -        for x in visited: -            st.append([str + x, deque(visited), deque(unvisited)]) +        for x in alphabet[0:visited]: +            st.append([str + x, visited]) -        if len(unvisited) > 0: -            x = unvisited[0] -            st.append([str + x, deque(visited), deque(unvisited)]) +        # len(str) < Nだから、visited < N +        st.append([str + alphabet[visited], visited + 1])