import copy

n = int(input())

ary_list = []
def f(ary, max_num):
    if len(ary) == n:
        ary_list.append(ary)
        return
    for i in range(max_num + 1):
        next_ary = copy.copy(ary)
        next_ary.append(i)
        f(next_ary, max_num + 1 if i == max_num else 0)

f([], 0)
ary_list

str_list = []
for i in range(len(ary_list)):
    for j in range(n):
        ary_list[i][j] = chr(97 + ary_list[i][j])
    str_list.append("".join(ary_list[i]))

str_list = sorted(str_list)

for s in str_list:
    print(s)
