# 幅優先探索による全探索

from collections import deque

import sys

read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines





def bfs(N):

    """

    param N:文字列の長さ



    """

    S = "abcdefghij"

    result = []

    queue = deque(["a"])

    

    while queue:

        s = queue.popleft()

        if len(s) == N:

            result.append(s + "\n")

            continue

        else:

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

                queue.append(s + i)

    

    return result





def main():

    N = int(readline())



    ans = bfs(N)

    print(("".join(ans)))





if __name__ == "__main__":

    main()

# 幅優先探索による全探索

from collections import deque

import sys

read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines





def bfs(N):

    """

    param N:文字列の長さ



    """

    S = "abcdefghij"

    result = []

    queue = deque(["a"])

    

    while queue:

        s = queue.popleft()

        if len(s) == N:

            result.append(s)

            continue

        else:

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

                queue.append(s + i)

    

    return result





def main():

    N = int(readline())



    ans = bfs(N)

    print(("\n".join(ans)))





if __name__ == "__main__":

    main()

# 幅優先探索による全探索
from collections import deque
import sys

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


def bfs(N):
    """
    param N:文字列の長さ
    """
    S = "abcdefghij"
    result = []
    queue = deque(["a"])
    while queue:
        s = queue.popleft()
        if len(s) == N:
            result.append(s + "\n")
            continue
        else:
            for i in S[: len(set(s)) + 1]:
                queue.append(s + i)
    return result


def main():
    N = int(readline())
    ans = bfs(N)
    print(("".join(ans)))


if __name__ == "__main__":
    main()

# 幅優先探索による全探索
from collections import deque
import sys

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


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


def main():
    N = int(readline())
    ans = bfs(N)
    print(("\n".join(ans)))


if __name__ == "__main__":
    main()

-            result.append(s + "\n") +            result.append(s) -    print(("".join(ans))) +    print(("\n".join(ans)))