# -*- coding: utf-8 -*-
import itertools
N = int(input())
def base10ton(num, n):
    if (int(num / n)):
        return base10ton(int(num / n), n) + str(num % n)
    return str(num % n)

def base10fromn(num_str, n):
    i = 0
    numlist = list(num_str);
    while (numlist):
        i *= n
        i += int(numlist.pop(0))
    return i

ans_list = []

alph_list = [chr(i) for i in range(97, 97+10)]

for i in range(base10fromn(str(N - 1) * N, N)):
    n_num = base10ton(i, N)
    ans_cand = ["0"] * (N - len(str(n_num)))
    ans_cand.extend(list(n_num))
    replace_num = 97
    ans_cand_rep = ans_cand
    for j in ans_cand:
        if j in ans_cand_rep:
            ans_cand_rep = [chr(replace_num) if k == j else k for k in ans_cand_rep]
            replace_num += 1
    ans_cand_str = "".join([str(l) for l in ans_cand_rep])
    ans_list.append(ans_cand_str)

ans = list(set(ans_list))
ans.sort()
print("\n".join(ans))