N = int(input())
done = 0
res = set()
pool = list('abcdefghijklmnopqrstuvwxyz')


def make_string(done):
    parent = [-1] * N

    def find(x):
        if parent[x] == -1:
            return x
        else:
            res = parent[x] = find(parent[x])
            return res

    def union(x, y):
        x = find(x)
        y = find(y)
        if x != y:
            parent[x] = y
    for x in range(N ** 2 // 2 + 1):
        if done & (1 << x):
            i, j = divmod(x, N)
            union(i, j)
    string = [None] * N
    j = 0
    for i in range(N):
        if string[find(i)] is None:
            string[i] = pool[j]
            string[find(i)] = pool[j]
            j += 1
    res = []
    for s in string:
        if s:
            res.append(s)
        else:
            res.append(pool[j])
            j += 1
    return ''.join(res)


def dp(done, memo={}):
    if done in memo:
        return
    elif done == (1 << (N ** 2)) - 1:
        return
    else:
        res.add(make_string(done))
        for i in range((N ** 2) // 2 + 1):
            if done & (1 << i):
                continue
            else:
                memo[done] = True
                dp(done | (1 << i), memo)


dp(0)
for x in sorted(list(res)):
    print(x)