N = gets.chomp.to_i

S = ("a".."z").to_a
ans = []

def print_s(s)
  s.map{|v| S[v]}.join
end

def combi(n, is)

end

s = Array.new(N, 0)
puts print_s(s)
# 使う文字種数 i-1
1.upto(N-1) do |i|
  (0..i-1).each{|j| s[j] = j}
  s[N-1] += 1
  bs = print_s(s[i..N-1])
  es = S[i] * (N-i)
  m = (0..i).map{|j| S[j]}
  pat = %(^(#{m.join("|")})[#{S[0]}-#{S[i]}]*$)
  (bs..es).select{|v| v =~ /#{pat}/}.each do |t|
    puts print_s(s[0..i-1]) + t
  end
end
