#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  double A[n][n];
  double B[n][n];
  double C[n][n];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> A[i][j];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      B[i][j] = (A[i][j] + A[j][i]) / 2;
      cout << fixed << setprecision(8) << B[i][j];
      cout << " ";
    }
    cout << endl;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      C[i][j] = (A[i][j] - A[j][i]) / 2;
      cout << fixed << setprecision(8) << C[i][j];
      cout << " ";
    }
    cout << endl;
  }
  return 0;
}
