import sys
readline = sys.stdin.readline

res = []
def fill(K, f):
    if K.count(-1) == 0:
        res.append(K)
        return 
    else:
        idx = []
        for i in range(N):
            if K[i] == -1:
                idx.append(i)
        kc = len(idx)
        for S in range(1, 1<<kc):
            if not S & 1:
                continue
            K2 = K[:]
            for j in range(kc):
                if S & (1<<j):
                    K2[idx[j]] = f
            fill(K2, f+1)
            
            
N = int(readline())
fill([-1]*N, 0)
res = [''.join(map(lambda x: chr(x+97), r)) for r in res]
print('\n'.join(res))
