n = gets.to_s.to_i

q = [["a",1]]

# a
# aa, ab
# aaa, aab, aba, abb, abc
(n-1).times do |i|
  
  q_n = []
  while q.any?
    
    s, m = q.shift
    
    (m+1).times do |j|
      q_n.push( [s + (97 + j).chr, m+1] )
    end
  end
  
  q = q_n.dup
  
end

puts q.map!{|w,_| w }