import sys
sys.setrecursionlimit(10**7)
n = int(input())

def rec(s, k, len):
    if len >= n:
        print("".join([chr(ord("a") + x) for x in s]))
        return
    for x in range(max(s[-1]+2, k+1)):
        rec(s + [x], max(k, x), len+1)

rec([0], 1, 1)
