# frozen_string_literal: true

n = gets.to_i

@s = []

10.times do |i|
  x = []
  (0..i).each do |j|
    x.push ('a'.ord + j).chr
  end
  @s.push x
end

@a = []
def dfs(s, x, n)
  return s if x == n

  @s[x].each do |c|
    y = dfs(s + c, x + 1, n)
    @a.push y if y
  end
  return nil
end

dfs('', 0, n)
puts @a
