#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
double a[n][n], aa[n][n], result1[n][n], result2[n][n];
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
cin >> a[i][j];
aa[j][i] = a[i][j];
}
}
for (int i = 0; i < n; i ++)
{
for (int j = 0; j < n; j ++)
{
result1[i][j] = 0.5 * ( a[i][j] + aa[i][j] );
result2[i][j] = 0.5 * ( a[i][j] - aa[i][j] );
}
}
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
cout << result1[i][j] << ' ';
}
cout << endl;
}
cout << endl;
for (int i = 0; i < n; i ++)
{
for (int j = 0; j < n; j ++)
{
cout << result2[i][j] << ' ';
}
cout << endl;
}
return 0;
}
ICAgICNpbmNsdWRlIDxpb3N0cmVhbT4KICAgIHVzaW5nIG5hbWVzcGFjZSBzdGQ7CiAgICAgCiAgICBpbnQgbWFpbigpIAogICAgewoJICAgIGludCBuOwoJICAgIGNpbiA+PiBuOwoJICAgIGRvdWJsZSBhW25dW25dLCBhYVtuXVtuXSwgcmVzdWx0MVtuXVtuXSwgcmVzdWx0MltuXVtuXTsKCSAgICBmb3IgKGludCBpID0gMDsgaSA8IG47IGkrKykKCSAgICB7CgkJCWZvciAoaW50IGogPSAwOyBqIDwgbjsgaisrKQoJCQl7CgkJCQljaW4gPj4gYVtpXVtqXTsKCQkJCWFhW2pdW2ldID0gYVtpXVtqXTsKCQkJfQoJICAgIH0KCSAgICBmb3IgKGludCBpID0gMDsgaSA8IG47IGkgKyspCgkgICAgewoJICAgIAlmb3IgKGludCBqID0gMDsgaiA8IG47IGogKyspCgkgICAgCXsKCSAgICAJCXJlc3VsdDFbaV1bal0gPSAwLjUgKiAoIGFbaV1bal0gKyBhYVtpXVtqXSApOwoJICAgIAkJcmVzdWx0MltpXVtqXSA9IDAuNSAqICggYVtpXVtqXSAtIGFhW2ldW2pdICk7CgkgICAgCX0KCSAgICB9CgkgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbjsgaSsrKQoJICAgICB7CgkJICAgICBmb3IgKGludCBqID0gMDsgaiA8IG47IGorKykKCQkgICAgIHsKCQkJICAgICBjb3V0IDw8IHJlc3VsdDFbaV1bal0gPDwgJyAnOwoJCSAgICAgfQoJCSAgICAgY291dCA8PCBlbmRsOwoJICAgICB9CgkgICAgIGNvdXQgPDwgZW5kbDsKCSAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBuOyBpICsrKQoJICAgICB7CgkJICAgICBmb3IgKGludCBqID0gMDsgaiA8IG47IGogKyspCgkJICAgICB7CgkJCSAgICAgY291dCA8PCByZXN1bHQyW2ldW2pdIDw8ICcgJzsKCQkgICAgIH0KCQkgICAgIGNvdXQgPDwgZW5kbDsKCSAgICAgfQoJCXJldHVybiAwOwp9