import collections

N = int(eval(input()))



S = "abcdefghij"

result = []

deq = collections.deque(["a"])



while deq:

    s = deq.popleft()

    if len(s) == N:

        result.append(s)

        continue

    else:

        for i in S[:len(set(s))+1]:

            deq.append(s + i)



print(('\n'.join(result)))
import collections



def bfs(N):

    S = "abcdefghij"

    result = []

    deq = collections.deque(["a"])



    while deq:

        s = deq.popleft()

        if len(s) == N:

            result.append(s)

            continue

        else:

            for i in S[:len(set(s))+1]:

                deq.append(s + i)

    return result



N = int(eval(input()))

ans = bfs(N)

print(('\n'.join(ans)))
import collections

N = int(eval(input()))
S = "abcdefghij"
result = []
deq = collections.deque(["a"])
while deq:
    s = deq.popleft()
    if len(s) == N:
        result.append(s)
        continue
    else:
        for i in S[: len(set(s)) + 1]:
            deq.append(s + i)
print(("\n".join(result)))

import collections


def bfs(N):
    S = "abcdefghij"
    result = []
    deq = collections.deque(["a"])
    while deq:
        s = deq.popleft()
        if len(s) == N:
            result.append(s)
            continue
        else:
            for i in S[: len(set(s)) + 1]:
                deq.append(s + i)
    return result


N = int(eval(input()))
ans = bfs(N)
print(("\n".join(ans)))

+ +def bfs(N): +    S = "abcdefghij" +    result = [] +    deq = collections.deque(["a"]) +    while deq: +        s = deq.popleft() +        if len(s) == N: +            result.append(s) +            continue +        else: +            for i in S[: len(set(s)) + 1]: +                deq.append(s + i) +    return result + + -S = "abcdefghij" -result = [] -deq = collections.deque(["a"]) -while deq: -    s = deq.popleft() -    if len(s) == N: -        result.append(s) -        continue -    else: -        for i in S[: len(set(s)) + 1]: -            deq.append(s + i) -print(("\n".join(result))) +ans = bfs(N) +print(("\n".join(ans)))