def permutationWithRepetitionListRecursive(data, r):
    if r <= 0:
        return []

    result = []
    _permutationWithRepetitionListRecursive(data, r, [], result)
    return result

def _permutationWithRepetitionListRecursive(data, r, progress, result):
    if r == 0:
        result.append(progress)
        return
    for i in range(len(data)):
        _permutationWithRepetitionListRecursive(data, r - 1, progress + [data[i]], result)
    

n =int(input())
alp = [chr(i+96) for i in range(1,n+1)]

pros = permutationWithRepetitionListRecursive(alp,n)
for pro in pros:
    print(''.join(pro))