#include <bits/stdc++.h>
using namespace std;
int w[171][171];
double a[171][171];
double b[171][171];
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++) {
    a[i][i] = w[i][i];
    b[i][i] = 0;
  }
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) {
      a[i][j] = (w[i][j] + w[j][i] + 0.0) / 2;
      a[j][i] = a[i][j];
      b[i][j] = w[i][j] - a[i][j];
      b[j][i] = w[j][i] - a[i][j];
    }
  cout << fixed << setprecision(8);
  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;
}
