import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import Data.List (unfoldr)

main :: IO ()
main = do
  (n : _) <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  mapM_ putStrLn . map (map (toEnum . (fromEnum 'a' +))) . fromTree n . toTree $ 0

data Tree = Node Int [Tree]

toTree :: Int -> Tree
toTree m = Node m (map toTree [0..(succ m)])

fromTree :: Int -> Tree -> [[Int]]
fromTree 1 (Node k _) = [[k]]
fromTree n (Node k ts) = map (k :) (concatMap (fromTree (pred n)) ts)

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
