import sys
import math
#sys.stdin=open("input.in","r")
#sys.stdout=open("output.out","w")
def toString(List): 
    return ''.join(List) 
def allLexicographicRecur (string, data, last, index,n): 
    length = len(string) 
    for i in range(length): 
        data[index] = string[i] 
        if index==last: 
            x=toString(data)
            if(len(x)==n and x[0]=="a"):
                print (x) 
        else: 
            allLexicographicRecur(string, data, last, index+1,n) 
def allLexicographic(string,n): 
    length = len(string) 
    data = [""] * (length+1)  
    string = sorted(string)  
    allLexicographicRecur(string, data, length-1, 0,n) 
st=""
al=["a","b","c","d","e","f","g","h","i","j"]
n=int(input())
for i in range(n):
    st+=al[i]
    allLexicographic(st,n)