import           Control.Monad
import qualified Data.ByteString.Char8 as BS
import           Data.Char
import           Data.Foldable
import           Data.Maybe
import qualified Data.Sequence         as Seq

readInt = fst . fromJust . BS.readInt
getInt = readInt <$> BS.getLine

main = do
  n <- getInt

  let dfs s mx | Seq.length s == n = putStrLn $ toList s
               | otherwise = do
                   forM_ ['a'..mx] $ \c ->
                     dfs (s Seq.|> c) (if c == mx
                                        then chr (ord mx + 1)
                                        else mx)
  dfs (Seq.fromList "") 'a'