module Main where

import Data.Functor
import Data.List

main :: IO ()
main =  do
 { [n,m,l] <- getInts
 ; mat1 <- loop n
 ; mat2 <- loop m
 ; mapM_ printInts (mxm mat1 mat2)
 }

loop :: Int -> IO [[Int]]
loop 0 = return []
loop n = do
  { l <- getInts
  ; ls <- loop (n-1)
  ; return (l:ls)
  }

getInts :: IO [Int]
getInts = map read . words <$> getLine

printInts :: [Int] -> IO ()
printInts = putStrLn . unwords . map show

dot :: [Int] -> [Int] -> Int
dot = (sum .) . zipWith (*)

mxv :: [[Int]] -> [Int] -> [Int]
mxv m v = [dot v' v | v' <- m ]

mxm :: [[Int]] -> [[Int]] -> [[Int]]
mxm m m' = transpose [mxv m v | v <- m'']
  where
    m'' = transpose m'