n = gets.chomp.to_i
$result = []

def rec  (str,val, n)
  if str.size == n
    $result << str
    return
  end
  (val+1).times do |i|
    rec(str + ("a".ord + i).chr, val, n)
  end
  rec(str + (str[-1].ord + 1).chr, val+1 , n)
end

rec("a", 1, n)

$result.sort.uniq.each do |str|
  puts str
end