#include <iostream>
using namespace std;
int main() {
int n;
cin>>n;
double x[n][n],y[n][n],z[n][n],mu=0;
for (int i = 0; i < n; i++){
for (int j = 0; j < n; j++){
cin>>x[i][j];
y[j][i]=x[i][j];
}
}
for (int i = 0; i < n; i++){
for (int j = 0; j < n; j++){
for (int p = 0; p < n; p++){
mu += x[i][p]*y[p][j];
}
z[i][j] = mu;
mu = 0;
}
}
for (int i = 0; i < n; i++){
for (int j = 0; j < n; j++){
cout<<z[i][j]<<" ";
}
cout<<endl;
}
}
ICAgICNpbmNsdWRlIDxpb3N0cmVhbT4KICAgIHVzaW5nIG5hbWVzcGFjZSBzdGQ7CiAgICAgCiAgICBpbnQgbWFpbigpIHsKICAgIAlpbnQgbjsKICAgIAljaW4+Pm47CiAgICAJZG91YmxlIHhbbl1bbl0seVtuXVtuXSx6W25dW25dLG11PTA7CiAgICAJZm9yIChpbnQgaSA9IDA7IGkgPCBuOyBpKyspewogICAgCQlmb3IgKGludCBqID0gMDsgaiA8IG47IGorKyl7CiAgICAJCQljaW4+PnhbaV1bal07CiAgICAJCQl5W2pdW2ldPXhbaV1bal07CiAgICAJCX0KICAgIAl9CiAgICAJZm9yIChpbnQgaSA9IDA7IGkgPCBuOyBpKyspewogICAgCQlmb3IgKGludCBqID0gMDsgaiA8IG47IGorKyl7CiAgICAJCQlmb3IgKGludCBwID0gMDsgcCA8IG47IHArKyl7CQogICAgCQkJCW11ICs9IHhbaV1bcF0qeVtwXVtqXTsKICAgIAkJCX0KICAgIAkJCXpbaV1bal0gPSBtdTsKICAgIAkJCW11ID0gMDsKICAgIAkJfQogICAgCX0KICAgIAlmb3IgKGludCBpID0gMDsgaSA8IG47IGkrKyl7CiAgICAJCWZvciAoaW50IGogPSAwOyBqIDwgbjsgaisrKXsKICAgIAkJCWNvdXQ8PHpbaV1bal08PCIgIjsKICAgIAkJfQogICAgCQljb3V0PDxlbmRsOwogICAgCX0KICAgIH0KCg==