import qualified Data.Vector.Mutable as VM
import qualified Data.Map as MP
import Control.Monad
import Data.List

solve :: Int -> String -> VM.IOVector [String] -> IO ()
solve n xs vec
  | n == length xs = do 
    rs <- VM.read vec 0
    VM.write vec 0 (xs:rs)
  | otherwise = forM_ ['a'..succ l] $ \x -> solve n (xs++[x]) vec
    where
      l = last xs

main = do 
  n <- readLn :: IO Int 
  table <- VM.replicate 1 [] :: IO (VM.IOVector [String])
  solve n "a" table
  res <- sort <$> VM.read table 0
  forM_ res $ putStrLn