n = gets.chomp.to_i
arr = []
arr[0] = ['a']

alpha = [*'a'..'z']

1.upto(n-1) do |i|
  arr[i] = []

  arr[i-1].each do |char|
    alpha[0,i+1].each do |al|
      arr[i] << char + al
    end
  end
end

arr[n-1].each do |val|
  puts val
end
