import itertools
import bisect

def main():
    N = int(input())
    letterset = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
    check = []
    for i in range(1, N+1):
        iters = itertools.product(letterset[:i], repeat=N)
        for tmp in iters:
            if len(set(tmp)) == i:
                flag = True
                if tmp[0] != 'a':
                    flag = False
                for k in range(N-1):
                    t = bisect.bisect_right(letterset, tmp[k])
                    if not tmp[k+1] in letterset[:t+1]:
                        flag = False
                if flag:
                    check.append(tmp)
                    print(''.join(tmp))

if __name__ == "__main__":
    main()
