#include <bits/stdc++.h>
int main(int argc, char const *argv[]) {
  int n, i, j;
  scanf("%d", &n);
  double w[n][n], a[n][n], b[n][n];
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      scanf("%lf", &w[i][j]);
    }
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      a[i][j] = (w[i][j] + w[j][i]) / 2.0;
      b[i][j] = w[i][j] - a[i][j];
    }
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      printf("%.8f ", a[i][j]);
    }
    printf("\n");
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      printf("%.8f ", b[i][j]);
    }
    printf("\n");
  }
  return 0;
}
