l = ['a','b','c','d','e','f','g','h','i','j']
N = int(input())

DONELIST = []
PROCESSLIST = ['a']
PROCESSLIST2 = []
for i in range(N-1):
    for j in range(len(DONELIST)):
        DONELIST[j] = 'a' + DONELIST[j]
    for j in range(len(PROCESSLIST)):
        DONELIST.append('a' + PROCESSLIST[j])
        for k in range(i+1):
            if PROCESSLIST[j] + chr(97+k) not in DONELIST:
                PROCESSLIST2.append(PROCESSLIST[j] + chr(97+k))

    PROCESSLIST2.append(PROCESSLIST[-1] + chr(97+len(PROCESSLIST[-1])))
    PROCESSLIST = PROCESSLIST2
    PROCESSLIST2 = []

for w in DONELIST:
    print(w)
for w in PROCESSLIST:
    print(w)
