'use strict';
(function(stdin) {
  //declare function
  function sum(a, b) {
    return a + b;
  }

  function fillArray(array, n) {
    for (var i = 0, len = array.length; i < len; i++) {
      array[i] = n;
    }
    return array;
  }

  function makeRow(matrix, n) {
    var row = fillArray(Array(matrix.length), 0);
    return row.map(function(v, i) {
      return matrix[i][n];
    });
  }

  function reverseMatrix(matrix) {
    var newMatrix = fillArray(Array(matrix[0].length));
    return newMatrix.map(function(v, i) {
      return makeRow(matrix, i);
    });
  }

  function mulMatrix(matrixX, matrixY) {
    var reverseY = reverseMatrix(matrixY);
    return matrixX.map(function(x) {
      return reverseY.map(function(y) {
        return y.map(function(z, j) {
          return z * x[j];
        }).reduce(sum);
      });
    });
  }

  function toStr(matrix) {
    return matrix.map(function(v) {
      return v.join(' ');
    }).join('\n');
  }
  //declare variable
  var inputs = stdin.toString().trim().split('\n').map(function(v) {
    return v.split(' ').map(Number);
  });
  var size = inputs.shift();
  var matrixA = inputs.splice(0, size[0]);
  var matrixB = inputs.splice(0, size[1]);
  //main

  //display
  console.log(toStr(mulMatrix(matrixA, matrixB)));
})(require('fs').readFileSync('/dev/stdin', 'utf8'));