import math
import sys
from decimal import *
import itertools

n= list(map(int, input().split()))

n = n[0]

ls = []
ts =[]
for i in range(n):
    ls.append(i+1)

for cb in itertools.product(ls, repeat=n):
    if cb[0] != 1:
        break
    ts.append(cb)

s = set()
for t in ts:
    stri = ""
    ch = 'a'
    used = {}


    for c in t:
        if c in used:
            stri += used[c]
        else:
            used[c] = ch;
            ch = chr(ord(ch) + 1)
            stri += used[c]
    s.add(stri)

ans = list(s)
sorted(ans)

for st in ans:
    print(st)