import Control.Monad

solve :: Int -> String -> IO ()
solve n xs
  | length xs == n = putStrLn xs
  | otherwise = 
    forM_ ['a'..succ l] (\c -> solve n (xs++[c]))
    where
      l :: Char
      l = last xs
  
main = do
  n <- readLn :: IO Int
  solve n "a"
