
class Solution:

    def solve(self, N: int):

        def dfs(prev_str: str, max_used_char: str):
            if len(prev_str) == N:
                print(prev_str)
                return
            else:

                for i in range(ord('a'), ord(max_used_char) + 2):
                    c = chr(i)
                    if i == ord(max_used_char) + 1:
                        dfs(prev_str + c, max_used_char)
                    else:
                        dfs(prev_str + c, c)

        dfs('a', 'a')


if __name__ == '__main__':

    # standard input
    N=int(input())
    # solve
    solution=Solution()
    answer=solution.solve(N)
