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


def dfs(s, i):
    if len(s) == N:
        ans = ''
        for j in range(N):
            ans += w[int(s[j])]
        print(ans)
    else:
        for k in range(i+1):
            dfs(s+str(k), i+1)


x = dfs('0', 1)
