import Control.Monad
import Data.List

solve :: Int -> [String] -> [String]
solve n xss 
  | (length $ head xss) == n = xss
  | otherwise = solve n xss'
    where
      xss' = concat $ map f xss
      f xs = [xs++[x] | x<-['a'..succ m]]
        where
          m = maximum xs

main = do 
  n <- readLn :: IO Int 
  let res = solve n ["a"]
  forM_ (sort res)  putStrLn
