/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
Scanner in
= new Scanner
(System.
in);
int m = in.nextInt();
int n = in.nextInt();
int A[][] = new int [m][n];
int AAt[][] = new int [m][m];
for(int i=0; i<m; i++){
for(int j=0; j<n; j++){
A[i][j] = in.nextInt();
}
}
for(int i=0; i<m; i++){
for(int j=0; j<m; j++){
int tmp=0;
for(int k=0; k<n; k++){
tmp+=A[i][k]*A[j][k];
}
AAt[i][j]=tmp;
}
}
for(int i=0; i<m; i++){
for(int j=0; j<m; j++){
System.
out.
print(AAt
[i
][j
]+" "); }
}
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJCVNjYW5uZXIgaW4gPSBuZXcgU2Nhbm5lcihTeXN0ZW0uaW4pOwoJCQoJCWludCBtID0gaW4ubmV4dEludCgpOwoJCWludCBuID0gaW4ubmV4dEludCgpOwoJCQoJCWludCBBW11bXSA9IG5ldyBpbnQgW21dW25dOwoJCWludCBBQXRbXVtdID0gbmV3IGludCBbbV1bbV07CgkJCgkJZm9yKGludCBpPTA7IGk8bTsgaSsrKXsKCQkJZm9yKGludCBqPTA7IGo8bjsgaisrKXsKCQkJCUFbaV1bal0gPSBpbi5uZXh0SW50KCk7CgkJCX0KCQl9CgkJZm9yKGludCBpPTA7IGk8bTsgaSsr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