import itertools


def main():
    abc = {1: 'a', 2: 'b', 3: 'c', 4: 'd', 5: 'e', 6: 'f', 7: 'g', 8: 'h', 9: 'i', 10: 'j',
           11: 'k', 12: 'l', 13: 'm', 14: 'n', 15: 'o', 16: 'p', 17: 'q', 18: 'r', 19: 's', 20: 't',
           21: 'u', 22: 'v', 23: 'w', 24: 'x', 25: 'y', 26: 'z'
           }
    N = int(input())
    comb = itertools.combinations_with_replacement(range(0, N), N)
    checked = list()

    for c in comb:
        tmp = list()
        tmp_dict = dict()
        for enum, s in enumerate(c):
            if s in tmp_dict:
                tmp.append(tmp_dict[s])
                continue
            tmp_dict[s] = enum
            tmp.append(enum)
        tmp_integer = ''.join(str(s) for s in tmp)
        if tmp_integer in checked:
            continue
        checked.append(tmp_integer)
    for c in checked:
        for s in c:
            print(abc[int(s) + 1], end='')
        print('\n', end='')


if __name__ == '__main__':
    main()
