import Data.List

main = interact $ show' . solve . read' . lines
  where
    solve (matA,matB) = [
                          [sum $ zipWith (*) u v  | v <- (transpose matB)]
                        | u <- matA]
    show' = unlines . map (unwords . map show)
    read' (nml:xs) = (f matA, f matB)
      where
        n = head . map readInt . words $ nml
        f = map (map readInt . words)
        (matA, matB) = splitAt n xs
        readInt = read :: String -> Int

