# -*- coding: utf-8 -*-
"""
Created on Sat Mar 14 22:00:05 2020

@author: naoki
"""
import sys
import itertools
#print(sys.getdefaultencoding())

N = int(input())
all_list = []
for i in range(0,N+1):
    if i != 1:
        all_list.extend(list(itertools.combinations(range(N),i)))

answer = [["x"] * N for _ in range(len(all_list))]
for i in range(len(answer)):
    num = 1
    exist = False
    for p in range(len(answer[i])):
        if p in all_list[i] and exist == False:
            Same = num
            answer[i][p] = Same
            num +=1
            exist = True
        elif p in all_list[i] and exist == True:
            answer[i][p] = Same
        else:
            answer[i][p] = num
            num += 1
            
char_ans = [[chr(answer[j][i]) for i in range(N)]for j in range(len(answer))]

ans = []
for i in range(len(char_ans)):
    ans.append("".join(str(j) for j in char_ans[i]))
ans = sorted(ans)

for i in range(len(ans)):
    print(ans[i])