#include <bits/stdc++.h>
using namespace std;
double w[200 + 1][200 + 1];
double a[200 + 1][200 + 1];
double b[200 + 1][200 + 1];
int n;
int min(int x, int y) { return x < y ? x : y; };
int main() {
  while (scanf("%d", &n) != -1) {
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        scanf("%lf", &w[i][j]);
      }
    }
    for (int i = 1; i <= n; i++) {
      for (int j = i + 1; j <= n; j++) {
        b[i][j] = (w[i][j] - w[j][i]) / 2;
        b[j][i] = -b[i][j];
        a[i][j] = (w[i][j] + w[j][i]) / 2;
        a[j][i] = a[i][j];
      }
    }
    for (int i = 1; i <= n; i++) {
      a[i][i] = w[i][i];
      b[i][i] = 0;
    }
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        printf(j != n ? "%.8f " : "%.8f\n", a[i][j]);
      }
    }
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        printf(j != n ? "%.8f " : "%.8f\n", b[i][j]);
      }
    }
  }
  return 0;
}
