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

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

rec([0], 1)
