import sys
stdin = sys.stdin
from itertools import product
mod = 10**9 + 7

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))


n = ni()
def f(n, first = "a"):
    for switch in product([0, 1], repeat=n-1):
        a = ord("a")
        #print(switch)
        now = "a"
        s = first
        for i, m in enumerate(switch):
            if m == 1 and now != "a":
                f(n-i, first=s)
            if m == 0 and now != "a":
                s += now
            elif m==0:
                s += "a"
            else:
                now = chr(ord(now)+1)
                s += now
        print(s)
f(n)