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

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

#print(res)
sorted(res)
che = 0
for i in range(1, len(res)):
    if res[che] == res[i]:
        che += 1
    else:
        print(res[i])
        che += 1