#include <bits/stdc++.h>
using namespace std;
double A[256][256], B[256][256], W[256][256];
int main() {
  int n;
  cin >> 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 < i + 1; j++) {
      B[i][j] = (W[i][j] - W[j][i]) / 2.0;
      if (j != i) B[j][i] = -B[i][j];
      A[i][j] = A[j][i] = W[j][i] + B[i][j];
    }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (j) printf(" ");
      printf("%.8lf", A[i][j]);
    }
    printf("\n");
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (j) printf(" ");
      printf("%.8lf", B[i][j]);
    }
    printf("\n");
  }
  return 0;
}
