def main():

    from string import ascii_lowercase

    dic = {i: s for i, s in enumerate(ascii_lowercase)}

    N = int(eval(input()))

    ans = []



    def dfs(s, mx):

        if len(s) == N:

            print(s)

            return

        else:

            for i in range(mx+2):

                v = s + dic[i]

                mx = max(mx, i)

                dfs(v, mx)

    dfs("a", 0)





if __name__ == '__main__':

    main()

def main():

    from string import ascii_lowercase

    dic = {i: s for i, s in enumerate(ascii_lowercase)}

    N = int(input())

    ans = []



    def dfs(s, mx):

        if len(s) == N:

            ans.append(s)

            return

        else:

            for i in range(mx+2):

                v = s + dic[i]

                mx = max(mx, i)

                dfs(v, mx)

    dfs("a", 0)

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





if __name__ == '__main__':

    main()

def main():
    from string import ascii_lowercase

    dic = {i: s for i, s in enumerate(ascii_lowercase)}
    N = int(eval(input()))
    ans = []

    def dfs(s, mx):
        if len(s) == N:
            print(s)
            return
        else:
            for i in range(mx + 2):
                v = s + dic[i]
                mx = max(mx, i)
                dfs(v, mx)

    dfs("a", 0)


if __name__ == "__main__":
    main()

def main():
    from string import ascii_lowercase

    dic = {i: s for i, s in enumerate(ascii_lowercase)}
    N = int(input())
    ans = []

    def dfs(s, mx):
        if len(s) == N:
            ans.append(s)
            return
        else:
            for i in range(mx + 2):
                v = s + dic[i]
                mx = max(mx, i)
                dfs(v, mx)

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


if __name__ == "__main__":
    main()

-    N = int(eval(input())) +    N = int(input()) -            print(s) +            ans.append(s) +    print(*ans, sep="\n")