import Control.Monad
import Data.Char
import Data.Function

main = do
  n <- readLn
  forM_ (solve n) putStrLn

solve :: Int -> [String]
solve n = go 'a' n
  where
    go :: Char -> Int -> [String]
    go _ 0 = [""]
    go c n = concat [map (c' :) (go d (n-1))|c' <- ['a' .. c], let d = chr $ (max `on` fromEnum) c (succ c')]