local mfl = math.floor
local n = io.read("*n")
local t = {string.rep("a", n)}
if 1 < n then
  t[2] = string.rep("a", n - 1) .. "b"

  local function solve(prefix, used, rem)
    if rem == 0 then
      table.insert(t, prefix)
    return end
    local mul = 1
    for i = 1, rem do
      mul = mul * used
    end
    for i = 0, mul - 1 do
      local str = ""
      for j = 1, rem do
        str = string.char(97 + i % used) .. str
        i = mfl(i / used)
      end
      table.insert(t, prefix .. str)
    end
    used = used + 1
    prefix = prefix .. string.char(96 + used)
    solve(prefix, used, rem - 1)
  end

  for i = n - 2, 1, -1 do
    local prefix = string.rep("a", i) .. "b"
    solve(prefix, 2, n - i - 1)
  end
end
print(table.concat(t, "\n"))
