import sys
from collections import deque

class alphabet(): #Trueなら大文字
    def __init__(self, capitalize):
        self.num = dict()
        self.index = dict()
        self.abc = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n"\
            ,"o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
        if capitalize: 
            for i in range(26): self.abc[i] = self.abc[i].upper()
        for i, a in enumerate(self.abc):
            self.num[a] = i
            self.index[str(i)] = a

def solve():
    N = int(input())
    AB = alphabet(False)
    Ans = []
    q = deque()
    q.append(("0", 1))
    while q:
        current, length = q.popleft()
        if length == N:
            ans = ""
            for i in range(N): ans += AB.index[current[i]]
            Ans.append(ans)
        else:
            border = int(current[length - 1])
            for j in range(border + 2):
                q.append((current + str(j), length + 1))
    for a in Ans: print(a)

    return 0

if __name__ == "__main__":
    solve()