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

combine :: [Int] -> [[Int]] -> [[Int]]
combine x [] = [[a] | a <-x]
combine (x:xs) (y:ys) = [[x] ++ y] ++ combine xs ys

t :: [[Int]] -> [[Int]]
t [x]    = [[a] | a <-x]
t (x:xs) = combine x (t xs)

dot :: [Int] -> [Int] -> Int
dot [x] [y] = x * y
dot (x:xs) (y:ys) = x * y + dot xs ys


main = do
    n:m:_ <- map read.words <$> getLine
    a <- replicateM n (map read.words <$> getLine) ::IO[[Int]]
    b <- replicateM m (map read.words <$> getLine) ::IO[[Int]]
    let bt = t b
    let c = [[ ar `dot` bl| bl <- bt] |ar <- a]
    putStrLn $ intercalate "\n" (map(unwords.map show) c)
    