local n = io.read("*n")
local tasks = {}
table.insert(tasks, {"a", 1})
local ret = {}
while 0 < #tasks do
  local task = tasks[#tasks]
  local w, used = task[1], task[2]
  table.remove(tasks)
  if #w == n then
    table.insert(ret, w)
  else
    for i = 1, used + 1 do
      local z = i <= used and used or used + 1
      table.insert(tasks, {w .. string.char(96 + i), z})
    end
  end
end
for i = #ret, 1, -1 do
  print(ret[i])
end
