import Control.Applicative

import Control.Monad
    (replicateM)

import Data.List
    (transpose)

type Vector = [Int]

type Matrix = [Vector]

type Problem = (Matrix, Matrix)

type Result = Matrix

multiply :: Vector -> Vector -> Int

multiply matrix1 matrix2
    = sum $ zipWith (*) matrix1 matrix2

solve :: Problem -> Result

solve (matrix1, matrix2)
    = [[multiply vector1 vector2 | vector2 <- matrix2t] | vector1 <- matrix1] where
        matrix2t = transpose matrix2

output :: Result -> String

output matrix
    = init.concat $ [outputVector vector ++ "\n" | vector <- matrix]

outputVector :: Vector -> String

outputVector vector
    = init.concat $ [show x ++ " " | x <- vector]

input :: IO Problem

input
    = do
        [n, m, _] <- map read.words <$> getLine
        matrix1 <- inputMatrix n
        matrix2 <- inputMatrix m
        return (matrix1, matrix2)

inputMatrix :: Int -> IO Matrix

inputMatrix n
    = map (map read.words) <$> replicateM n getLine

main :: IO ()

main
    = putStrLn.output =<< solve <$> input