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