Problem: Chubby Yang is studying linear equations right now. He came up with a nice problem. In the problem you are given an n × n matrix W, consisting of integers, and you should find two n × n matrices A and B, all the following conditions must hold: 

  * Aij = Aji, for all i, j (1 ≤ i, j ≤ n); 
  * Bij = - Bji, for all i, j (1 ≤ i, j ≤ n); 
  * Wij = Aij + Bij, for all i, j (1 ≤ i, j ≤ n). 



Can you solve the problem?

Input

The first line contains an integer n (1 ≤ n ≤ 170). Each of the following n lines contains n integers. The j-th integer in the i-th line is Wij (0 ≤ |Wij| < 1717).

Output

The first n lines must contain matrix A. The next n lines must contain matrix B. Print the matrices in the format equal to format of matrix W in input. It is guaranteed that the answer exists. If there are multiple answers, you are allowed to print any of them.

The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 4.

Examples

Input

2
1 4
3 2


Output

1.00000000 3.50000000
3.50000000 2.00000000
0.00000000 0.50000000
-0.50000000 0.00000000


Input

3
1 2 3
4 5 6
7 8 9


Output

1.00000000 3.00000000 5.00000000
3.00000000 5.00000000 7.00000000
5.00000000 7.00000000 9.00000000
0.00000000 -1.00000000 -2.00000000
1.00000000 0.00000000 -1.00000000
2.00000000 1.00000000 0.00000000

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
auto t1 = chrono::high_resolution_clock::now();
bool prime[1000001];
long long expo(long long a, long long b) {
  if (b == 0) return 1;
  if (b % 2)
    return ((a % 1000000007) *
            (expo((a * a) % 1000000007, b / 2) % 1000000007)) %
           1000000007;
  return expo((a * a) % 1000000007, b >> 1) % 1000000007;
}
long long mul(long long a, long long b) {
  a = a % 1000000007;
  b = b % 1000000007;
  if (b == 0) return 0;
  if (b % 2)
    return ((a % 1000000007) +
            (mul((a + a) % 1000000007, b >> 1) % 1000000007)) %
           1000000007;
  return mul((a + a) % 1000000007, b >> 1) % 1000000007;
}
bool ispoweroftwo(long long x) { return x && !(x & (x - 1)); }
long long xorcal(long long n) {
  if (n % 4 == 0) return n;
  if (n % 4 == 1) return 1;
  if (n % 4 == 2) return n + 1;
  if (n % 4 == 3) return 0;
}
void sieve(long long n) {
  memset(prime, true, sizeof(prime));
  prime[0] = false;
  prime[1] = false;
  for (long long i = 2; i * i <= n; i++) {
    if (prime[i] == true) {
      for (long long j = i * i; j <= n; j += i) prime[j] = false;
    }
  }
}
bool isprime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 or n % 3 == 0) return false;
  for (long long i = 5; i * i <= n; i += 6) {
    if (n % i == 0 or n % (i + 2) == 0) return false;
  }
  return true;
}
long long modinverse(long long a, long long m) {
  long long m0 = m;
  long long y = 0, x = 1;
  if (m == 1) return 0;
  while (a > 1) {
    long long q = a / m;
    long long t = m;
    m = a % m;
    a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += m0;
  return x;
}
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return (b % a, a);
}
bool ispalindrome(string s) {
  string t = s;
  reverse(t.begin(), t.end());
  if (t == s) return true;
  return false;
}
void binary(long long a[], long long n) {
  for (int i = 64 - 1; i >= 0; i--) {
    long long k = n >> i;
    a[i] = k & (long long)1;
  }
}
long long countBits(long long n) {
  if (n == 0) return 0;
  return 1 + countBits(n & (n - 1));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long w[n][n];
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) cin >> w[i][j];
  }
  long double a[n][n], b[n][n];
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      a[i][j] = 1e6;
      b[i][j] = 1e6;
    }
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      if (i == j) a[i][j] = (long double)w[i][j];
    }
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      if (i == j) b[i][j] = (long double)0;
    }
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      if (i == j) continue;
      if (a[i][j] == 1e6) {
        a[i][j] = (long double)(w[i][j] + w[j][i]) / (long double)2;
        b[i][j] = (long double)(w[i][j] - w[j][i]) / (long double)2;
        a[j][i] = a[i][j];
        b[j][i] = -b[i][j];
      }
    }
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++)
      cout << fixed << setprecision(5) << a[i][j] << " ";
    cout << endl;
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++)
      cout << fixed << setprecision(5) << b[i][j] << " ";
    cout << endl;
  }
  auto t2 = chrono::high_resolution_clock::now();
  auto duration = chrono::duration_cast<chrono::milliseconds>(t2 - t1).count();
  clog << "Time taken = " << duration * 1.0 / 1000 << " seconds" << endl;
  return 0;
}