#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  float w[n][n];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> w[i][j];
    }
  }
  float a[n][n];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i == j)
        a[i][j] = w[i][j];
      else {
        a[i][j] = (w[i][j] + w[j][i]) / 2;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cout << fixed << setprecision(6) << a[i][j];
      cout << " ";
    }
    cout << endl;
  }
  float b[n][n];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      b[i][j] = w[i][j] - a[i][j];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cout << fixed << setprecision(6) << b[i][j];
      cout << " ";
    }
    cout << endl;
  }
}
