import sys
sys.setrecursionlimit(10**9)
def main():
    N = int(input())
    s = ''
    l = []
    def calc3(s, N):
        if len(s) == N:
            l.append(s)
            return
        if len(s) > 0:
            c = s[-1]
            s2 = s[:]
            z = ord(c) - ord('a') + 2
            for i in range(z):
                st = s[:]
                st += chr(ord('a')+i)
                calc3(st[:], N)
        else:
            c = 'a'
            s += chr(ord(c))
            calc3(s[:], N)
    calc3(s[:], N)
    l = sorted(set(l))
    for i in l:
        print(i)
main()
