let scan_int = Scanf.scanf "%d " (fun x -> x);;
let mat_prod_elem a b i k m =
  let rec mat_prod_elem a b i j k m =
    if j=m then 0 else
      a.(i).(j) * b.(j).(k) + mat_prod_elem a b i (j+1) k m
  in mat_prod_elem a b i 0 k m;;
let solve n m l =
  let mata = Array.make_matrix n m 0 
  and matb = Array.make_matrix m l 0
  and matc = Array.make_matrix n l 0
  in
  for i=0 to n-1 do
    for j=0 to m-1 do
      mata.(i).(j) <- scan_int
    done
  done;
  for j=0 to m-1 do
    for k=0 to l-1 do
      matb.(j).(k) <- scan_int
    done
  done;
  for i=0 to n-1 do
    for k=0 to l-1 do
      matc.(i).(k) <- mat_prod_elem mata matb i k m
    done
  done;
  for i=0 to n-1 do
    for k=0 to l-1 do
      Printf.printf "%d" matc.(i).(k);
      if k=l-1 then Printf.printf "\n" else Printf.printf " "
    done
  done
    in Scanf.scanf "%d %d %d " solve;;