import itertools
alp = [chr(ord('a') + i) for i in range(26)]
N = int(input())
allS = list(itertools.combinations_with_replacement(alp[0:N], N))
answers = []
PatternList = []
for s in allS:
    pattern = []
    letters = []
    num = 0
    for l in s:
        if not(l in letters):
            letters.append(l)
        pattern.append(letters.index(l))
    if not(pattern in PatternList):
        PatternList.append(pattern)
        answers.append(s)
for answer in answers:
    print(''.join(answer))