import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [h,w] <- getIntList
    n <- getInt
    as <- getIntList
    mapM_ putStrLn $ map (unwords . (map show)) . grid w True $ coloring as

coloring as = concatMap (\(i,a) -> replicate a i) $ zip [1..] as

grid _ _ [] = []
grid w b a = (if b then t else reverse t) : grid w (not b) d
    where (t,d) = splitAt w a