import Control.Applicative
import Control.Monad
import Data.List

myRead :: [String] -> [[Int]]
myRead = map (map (read :: String -> Int) . words)

matMul' :: [Int] -> [Int] -> Int
matMul' [] _          = 0
matMul' _ []          = 0
matMul' (a:as) (b:bs) = a * b + matMul' as bs

matMul :: [Int] -> [[Int]] -> [Int]
matMul _ []      = []
matMul as (b:bs) = matMul' as b : matMul as bs

solver' :: [[Int]] -> [[Int]] -> [[Int]]
solver' [] _      = []
solver' (a:as) bs = matMul a (transpose bs) : solver' as bs

solver :: [[Int]] -> [[Int]] -> [String]
solver matA matB =
  let matC = solver' matA matB
--  in map unwords (map (map show) matC)
  in map (unwords . map show) matC


main :: IO()
main = do
  (n:m:_) <- map (read :: String -> Int) . words <$> getLine
  matA <- myRead <$> replicateM n getLine
  matB <- myRead <$> replicateM m getLine
  mapM_ putStrLn $ solver matA matB