import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7

N = int(input())

lst1 = ['a']
lst2 = []
for i in range(N - 1):
    if i % 2 == 0: #lst1 -->lst2
        lst2 = []
        for s in lst1:
            last = ord(s[i]) - ord('a')
            for j in range(last + 2):
                lst2.append(s + chr(j + ord('a')))
    else:
        lst1 = []
        for s in lst2:
            last = ord(s[i]) - ord('a')
            for j in range(last + 2):
                lst1.append(s + chr(j + ord('a')))
           
if len(lst2) > len(lst1):
    lst2.sort()
    print (*lst2, sep = '\n')
else:
    lst1.sort()
    print (*lst1, sep = '\n')