import Data.List
import Control.Monad

main = do
  [h,w] <- map read . words <$> getLine
  n <- readLn
  as <- map read . words <$> getLine
  putStrLn $ unlines $ map (unwords . map show) (coloring h w n as)

coloring h w n as = zipWith ($) (cycle [id,reverse]) sns
  where
    sns = splitOn w ns
    ns = concat $ zipWith (\x a -> replicate a x) [1..n] as

splitOn :: Int -> [a] -> [[a]]
splitOn n = unfoldr (\xs -> guard ((not.null) xs) >> return (splitAt n xs))