import sys,math
sys.setrecursionlimit(10**9)
import itertools
from collections import defaultdict
 
IA = lambda: map(int,input().split())
IAS= lambda: map(str,input().split())

n=int(input())
temp=[]
num=0
x=1
for i in range(1,n+1):
  x*=2
for st in itertools.permutations(a,n):
    temp.append(st)
    num+=1
    if num==x-i:break

for x in temp:
  for i in x:
    print(x[i],end="")
  print()
  
