n = gets.to_i

new = [[0]]

(n-1).times do |i|
    o = new
    new = []
    # p o
    o.each do |t|
        type = t.uniq.size
        (type+1).times do |j|
            new.append(t.dup.append(j))
        end
    end
end

new.sort!

puts new.map{|a| a.map{|e| (e+97).chr}.join}

# n = 1
# a
# [0]

# n = 2
# aa
# ab
# [[0,0], [0,1]]

# n = 3
# aaa -> 1,1
# aab, aba, abb -> 2,1
# abc -> 3,1
# [0,0,0], [[0 0 1] [0 1 0] [0 0 1]] [0 1 2]


# n = 4
# aaaa
# aaab,aaba, abaa, aabb,abbb
# aabc,abac,abac,abca,abcb,abcc
# abcd
