import sys
from collections import deque

class alphabet(): #Trueなら大文字
    def __init__(self):
        self.index = dict()
        self.abc = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]
        for i, a in enumerate(self.abc): self.index[str(i)] = a

def solve():
    N = int(input())
    AB = alphabet()
    Ans = []
    q = deque()
    q.append(("a", 1))
    while q:
        current, length = q.popleft()
        if length == N: Ans.append(current)
        else:
            q.append((current + "a", length + 1))
            for k in range(10):
                q.append((current + AB.abc[k + 1], length + 1))
                if AB.abc[k] == current[length - 1]: break
    Ans.sort()
    for a in Ans: print(a)
    return 0

if __name__ == "__main__":
    solve()