import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7


s = 'abcdefghijklmnop'
N = I()
s = s[:N]

from itertools import product
seen = set()
for x in product(s,repeat=N):
    d = dict()
    pat = ''
    i = 1
    for n in x:
        if d.get(n) is None:
            d[n] = str(i)
            pat += str(i)
            i += 1
        else:
            pat += d[n]
    if pat in seen:
        continue
    print(''.join(x))
    seen.add(pat)