import sys
sys.setrecursionlimit(10 ** 7)

from string import ascii_lowercase
d = dict(zip(ascii_lowercase, range(26)))
N = int(input())

def nexts(s, n):
    if n == N:
        print(s)
        return
    prenum = d[s[-1]] + 1
    for i in range(prenum+1):
        nexts(s + ascii_lowercase[i], n+1)

nexts('a', 1)
