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