import sys, math
def input():
    return sys.stdin.readline()[:-1]
from itertools import permutations, combinations, product
from itertools import combinations_with_replacement as cwr
from collections import defaultdict, Counter, deque
from math import factorial
from bisect import bisect_left #bisect_left(list, value)
#from fractions import gcd
enu = enumerate

sys.setrecursionlimit(10**7)
N = int(input())

# i: num of different char
s = ['a'] * N
end = [chr(i) for i in range(97, 97+N)]

l = list(product(end, repeat=N))
#for nli in l:
#    print(''.join(nli))

nl = []
for val in l:
    addflg = True
    shuruisuu = len(set(val))
    for i in range(N):
        if not(addflg):
            break

#        if i < N-1:
#            if val[i] > val[i+1]:
#                addflg = False
#                break

        if ord(val[i])-97 > i:
            addflg = False
            break

#        if ord(val[i])-97 >= shuruisuu:
#            addflg = False
#            break

    if addflg:
        nl.append(val)

for nli in nl:
    print(''.join(nli))
