import copy
N = int(input())

moji = ["a","b","c","d","e","f","g","h","i","j"]
start = ["a"]
ll = [[] for i in range(11)] #0個目は使わない

def syurui(l):
    return len(set(l))

ll[1].append(["a"])

for i in range(2,N+1):
    for j in range(len(ll[i-1])):
        for k in range(syurui(ll[i-1][j])+1):
            tmp = copy.copy(ll[i-1][j])
            ll[i-1][j].append(moji[k])
            ll[i].append(ll[i-1][j])
            ll[i-1][j] = tmp

for i in range(len(ll[N])):
    print(*ll[N][i])