import copy

n = int(input())
#res = []
table = ['a']

def dfs(s, time, table):
    tab = copy.deepcopy(table)
    l = len(tab)
    mi = ord(s[0])
    for i in range(time):
        if mi < ord(s[i]):
            mi = ord(s[i])
            if s[i] in tab:
                 pass
            else:
                tab.append(s[i])
    mi += 1
    
    if time == n:
        #print(tab)
        if s in res:
            pass
        else:
            #res.append(s)
            print(s)
    else:
        #dfs(s+chr(mi), time+1, tab)
        for i in range(l):
            dfs(s+tab[i], time+1, tab)
        dfs(s+chr(mi), time+1, tab)
            
dfs('a', 1, table)

#res.sort()
#for i in range(len(res)):
#    print(res[i])