module Main where
--import Debug.Trace
import Data.List
import Data.Array
import Data.Maybe
import Data.Ord
import Control.Monad

solve :: [Int]-> [[Int]] -> [[Int]] -> [[Int]]
solve [n, m, l] anm bml = iterR 0 where
    iterR r
        | r >= n    = []
        | otherwise = iterC 0 : iterR (r+1) where
            iterC c
                | c >= l = []
                | otherwise = prod 0 : iterC (c+1) where
                    prod x
                        | x >= m = 0
                        | otherwise = aij ! (r, x) * bij ! (x, c) + prod (x+1)
    aij = listArray ((0,0),(n-1,m-1)) (concat anm)
    bij = listArray ((0,0),(m-1,l-1)) (concat bml)

readLine:: IO [Int]
readLine = fmap (map read . words) getLine

readUntil :: ([Int] -> Bool) -> IO [[Int]]
readUntil eof = iter where
    iter = readLine >>=
            (\a -> if eof a then return [] else fmap (a:) iter)

readLines :: Int -> IO [[Int]]
readLines 0 = return []
readLines n = readLine >>= (\a -> fmap (a:) (readLines (pred n)))
            
eof :: [Int] -> Bool
eof (x0:x1:xs) = all (==0) [x0, x1]

main :: IO() 
main = do
    [n, m, l] <- readLine
    anm  <- readLines n
    bml  <- readLines m
    mapM_ putStrLn $ map (\y -> concatMap (\x-> show x ++ " ") y) (solve [n, m, l] anm bml)

