import sys
sys.setrecursionlimit(100000000)
readline = sys.stdin.readline
from collections import deque

N = int(readline())

alph = 'abcdefghij'

seq = deque()

def dfs(a):
    seq.append(a)
    if len(seq) == N:
        print(''.join([alph[i] for i in seq]))
    else:
        m = min(N - 1, a + 1)
        for i in range(m + 1):
            dfs(i)
    seq.pop()

dfs(0)