import Control.Monad

main = do
  n <- read <$> getLine
  forM_ (loop n) $ \str -> putStrLn str

 where
   loop :: Int -> [String]
   loop 1 =  ["a"]
   loop n = [prev ++ [new] | prev <- loop (n-1), new <- take n ['a'..], new=='a' || (pred new) `elem` prev]-- ++ [take n ['a'..]]