class String
  def to_pattern
    arr = self.split('')
    map = {}
    set = Hash.new(false)
    arr.each do |i|
      unless set[i]
        set[i] = true
        map[i] = (set.length - 1).to_s
      end
    end
    arr.inject("") { |acc, a| acc + map[a] }
  end
end
alp = 'abcdefghijklmnopqrstuvwxyz'.split('')
memo = Hash.new(false)
n = gets.to_i
queue = []
queue << 'a'
(n - 1).times do |i|
  m = queue.size
  m.times do
    q = queue.shift
    alp[0..(i + 1)].each do |w|
      pattern = (q + w).to_pattern
      unless memo[pattern]
        queue << q + w
        memo[pattern] = true
      end
    end
  end
end
queue.each do |i|
  puts i
end