#include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
int **A = new int*[n];
for (int i=0;i<n;i++)
A[i] = new int [n];
int **B = new int*[n];
for (int i=0;i<n;i++)
B[i] = new int [n];
int **C = new int*[n];
for (int i=0;i<n;i++)
C[i] = new int [n];
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
cin>>A[i][j];
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
cin>>B[i][j];
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
{
for(int k=0;k<n;k++)
C[i][j]=C[i][j]+A[i][k]*B[k][j];
}
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
cout<<C[i][j]<<" ";
cout<<"\n";
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSAKewoJaW50IG47CgljaW4+Pm47CgkKCWludCAqKkEgPSBuZXcgaW50KltuXTsgCglmb3IgKGludCBpPTA7aTxuO2krKykKICAgICAgICBBW2ldID0gbmV3IGludCBbbl07CiAgICAgICAgCiAgICBpbnQgKipCID0gbmV3IGludCpbbl07IAogICAgZm9yIChpbnQgaT0wO2k8bjtpKyspCiAgICAgICAgQltpXSA9IG5ldyBpbnQgW25dOwogICAgICAgIAogICAgICBpbnQgKipDID0gbmV3IGludCpbbl07IAogICAgZm9yIChpbnQgaT0wO2k8bjtpKyspCiAgICAgICAgQ1tpXSA9IG5ldyBpbnQgW25dOwogICAgCiAgICBmb3IoaW50IGk9MDtpPG47aSsrKQogICAgCWZvcihpbnQgaj0wO2o8bjtqKyspCiAgICAJCWNpbj4+QVtpXVtqXTsKICAgIAkJCiAgICBmb3IoaW50IGk9MDtpPG47aSsrKQogICAgCWZvcihpbnQgaj0wO2o8bjtqKyspCiAgICAJCWNpbj4+QltpXVtqXTsKCiAgICBmb3IoaW50IGk9MDtpPG47aSsrKQogICAgCWZvcihpbnQgaj0wO2o8bjtqKyspCiAgICAJCXsKICAgIAkJCWZvcihpbnQgaz0wO2s8bjtrKyspCiAgICAJCQlDW2ldW2pdPUNbaV1bal0rQVtpXVtrXSpCW2tdW2pdOwogICAgCQl9CiAgICAKICAKCiAgICBmb3IoaW50IGk9MDtpPG47aSsrKQogICAgICAgewogICAgCWZvcihpbnQgaj0wO2o8bjtqKyspCiAgICAJCWNvdXQ8PENbaV1bal08PCIgIjsKICAgIAljb3V0PDwiXG4iOwogICAgICAgfQoJcmV0dXJuIDA7CgkKfQ==