#include <bits/stdc++.h>
using namespace std;
int main() {
  long int n;
  cin >> n;
  float m1[n][n];
  for (long int i = 0; i < n; i++)
    for (long int j = 0; j < n; j++) cin >> m1[i][j];
  float m2[n][n], m3[n][n];
  for (long int i = 0; i < n; i++)
    for (long int j = 0; j <= i; j++) {
      float a, b;
      a = m1[i][j] + m1[j][i];
      a = a / 2;
      b = m1[i][j] - a;
      m2[i][j] = a;
      m2[j][i] = a;
      m3[i][j] = b;
      m3[j][i] = -b;
    }
  for (long int i = 0; i < n; i++) {
    for (long int j = 0; j < n; j++) cout << m2[i][j] << " ";
    cout << "\n";
  }
  for (long int i = 0; i < n; i++) {
    for (long int j = 0; j < n; j++) cout << m3[i][j] << " ";
    cout << "\n";
  }
}
