import sys

read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines





def dfs(N):

    """

    param N:文字列の長さ



    """

    result = []

    stack = [("a", 1)]

    

    while stack:

        s, max_ = stack.pop()

        if len(s) == N:

            result.append(s)

            continue

        else:

            for i in range(max_+1):

                stack.append((s + chr(97+i), max(max_, i+1)))

    

    return result





def main():

    N = int(readline())



    ans = dfs(N)

    print(("\n".join(ans[::-1])))

            



if __name__ == "__main__":

    main()

# 深さ優先探索による全探索

import sys

read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines





def dfs(N):

    """

    param N:文字列の長さ



    """

    S = "abcdefghij"

    result = []

    stack = ["a"]

    

    while stack:

        s = stack.pop()

        if len(s) == N:

            result.append(s)

            continue

        else:

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

                stack.append(s + i)

    

    return result





def main():

    N = int(readline())



    ans = dfs(N)

    print(("\n".join(ans[::-1])))

            



if __name__ == "__main__":

    main()

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines


def dfs(N):
    """
    param N:文字列の長さ
    """
    result = []
    stack = [("a", 1)]
    while stack:
        s, max_ = stack.pop()
        if len(s) == N:
            result.append(s)
            continue
        else:
            for i in range(max_ + 1):
                stack.append((s + chr(97 + i), max(max_, i + 1)))
    return result


def main():
    N = int(readline())
    ans = dfs(N)
    print(("\n".join(ans[::-1])))


if __name__ == "__main__":
    main()

# 深さ優先探索による全探索
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines


def dfs(N):
    """
    param N:文字列の長さ
    """
    S = "abcdefghij"
    result = []
    stack = ["a"]
    while stack:
        s = stack.pop()
        if len(s) == N:
            result.append(s)
            continue
        else:
            for i in S[: len(set(s)) + 1]:
                stack.append(s + i)
    return result


def main():
    N = int(readline())
    ans = dfs(N)
    print(("\n".join(ans[::-1])))


if __name__ == "__main__":
    main()

+# 深さ優先探索による全探索 +    S = "abcdefghij" -    stack = [("a", 1)] +    stack = ["a"] -        s, max_ = stack.pop() +        s = stack.pop() -            for i in range(max_ + 1): -                stack.append((s + chr(97 + i), max(max_, i + 1))) +            for i in S[: len(set(s)) + 1]: +                stack.append(s + i)