import sys
sys.setrecursionlimit(10 ** 6)


N = int(input())
ans = []
a = ord('a')


def f(l, nmax, num):
    global N, a
    if l == N:
        ans.append(''.join(num))
    else:
        for i in range(nmax + 1):
            S = num + [chr(i + a)]
            f(l + 1, nmax + 1, S)


f(0, 0, [])

ans.sort()
print(*ans, sep='\n')
