N = int(input())
lst = ['a','b','c','d','e','f','g','h','i','j']

l = list()
c = 0

def dp(w,c):
    if len(w) == N:
        if w not in l:
            l.append(w)
        return
    for v in range(N):
        if str(v) not in w:
            c += 1
        dp(w+str(c),c)

dp('0',c)
for i in l:
    ans = ''
    for j in i:
        ans = ans + lst[int(j)]
    print(ans)