# -*- coding: utf-8 -*-
from collections import deque
import copy
str_list_befor = ['0', '1', '2','3','4','5', '6', '7','8','9']
str_list_after = ['a', 'b', 'c','d','e','f', 'g', 'h','i','j']

n = int(input())

dq = deque()
dq.append([0])
if n > 1:
    for i in range(n-1):
        # print("i: " + str(i))
        for j in range(len(dq)):
            # print("j: " + str(j))
            prv = dq.popleft()
            for j in range(prv[-1]+2):
                tmp = copy.copy(prv)
                tmp.append(j)
                # print(tmp)
                dq.append(tmp)
            # print(dq)

for i in range(len(dq)):
    result = ""
    tmp_r = dq.popleft()
    result = "".join(map(str, tmp_r))
    for j in range(len(str_list_befor)):
        result = result.replace(str_list_befor[j], str_list_after[j])

    print(result)
