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

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

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