#require 'pp'

n = gets.to_i
chars = Array.new(n, 'a')

m = {
    1 => 'a',
    2 => 'b',
    3 => 'c',
    4 => 'd',
    5 => 'e',
    6 => 'f',
    7 => 'g', 
    8 => 'h',
    9 => 'i',
}
max = m[n]

def n(ch, m)
    if ch == m
        ['a', true]
    else
        [ch.succ, false]
    end
end

puts chars.join

tail = n - 1 
while tail != 0
    nex, dig = n(chars[tail], max)
    if dig
        chars[tail] = 'a'
        tail -= 1
    else
        if chars[tail-1].succ == chars[tail]
            chars[tail] = 'a'
            tail -= 1
        else
            chars[tail] = nex
            tail = n - 1
            puts chars.join
        end
    end
end
