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:   A_{ij} = A_{ji}, for all i, j (1 ≤ i, j ≤ n);  B_{ij} =  - B_{ji}, for all i, j (1 ≤ i, j ≤ n);  W_{ij} = A_{ij} + B_{ij}, 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 W_{ij} (0 ≤ |W_{ij}| < 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

Difficulty: interview

Starter code:

Solutions:
n = int(input())
p = [list(map(int, input().split())) for i in range(n)]
t = [[0] * n for i in range(n)]
for i in range(n):
    t[i][i], p[i][i] = p[i][i], 0
    for j in range(i + 1, n):
        t[j][i] = t[i][j] = d = (p[i][j] + p[j][i]) / 2
        p[i][j] -= d
        p[j][i] -= d
for i in t: print(' '.join(map(str, i)))
for i in p: print(' '.join(map(str, i)))



n = int(input())
w = [];a = [];b=[]
for i in range(n):
    w.append(list(map(int,input().split())))
    a.append(list(range(n)))
    b.append(list(range(n)))
for i in range(n):
    for j in range(n):
        a[i][j]=(w[i][j]+w[j][i])/2
        b[i][j]=(w[i][j]-w[j][i])/2
for i in range(n):
    for j in range(n):
        print('{0:0.8f}'.format(a[i][j]),end=' ')
    print()
for i in range(n):
    for j in range(n):
        print('{0:0.8f}'.format(b[i][j]),end=' ')
    print()

import math

def cmp(a):
    return a[1]*10000+a[0]

n = int(input())
W =  [list(map(float, input().split(' '))) for i in range(n)]

A = [[0 for i in range(n)] for j in range(n)]
B = [[0 for i in range(n)] for j in range(n)]

for i in range(n):
    for j in range(n):
        if i!=j:
            if i>j:
                S = W[i][j]
                R = W[j][i]
                det = -2
                detA = -S-R
                detB = R-S
                a = detA/det
                b = detB/det
                A[i][j] = a
                A[j][i] = a
                B[i][j] = b
                B[j][i] = -b
        else:
            A[i][j] = W[i][j]
            B[i][j] = 0

s = ""
for i in range(n):
    for j in range(n):
        s+=str(A[i][j])+" "
    s+="\n"

print(s)


s = ""
for i in range(n):
    for j in range(n):
        s+=str(B[i][j])+" "
    s+="\n"

print(s)

i = int(input())
if i == 1:
    print(int(input()))
    print(0)
else:
    orig = [list(map(int, input().split(' '))) for a in range(i)]
    a = [[0]*i for _ in range(i)]
    b = [[0]*i for _ in range(i)]
    for x in range(i):
        a[x][x] = orig[x][x]

    for x in range(0, i):
       for y in range(x+1, i):
           a[x][y] = (orig[x][y]+orig[y][x])/2
           a[y][x] = (orig[x][y]+orig[y][x])/2
           b[x][y] = (orig[x][y]-orig[y][x])/2
           b[y][x] = -(orig[x][y]-orig[y][x])/2

    for i in a:
        print(' '.join([str(x) for x in i]))
    for i in b:
        print(' '.join([str(x) for x in i]))


n = int(input())
A = [[0 for i in range(n)] for j in range(n)]
B = [[0 for i in range(n)] for j in range(n)]
W = []
for i in range(n):
    s = list(map(int, input().split()))
    W.append(s)
for i in range(n):
    for j in range(i, n):
        if i == j:
            A[i][j] = W[i][j]
        else:
            sred = (W[i][j] + W[j][i]) / 2
            A[i][j] = sred
            A[j][i] = sred
            B[i][j] = W[i][j] - sred
            B[j][i] = W[j][i] - sred
for i in A:
    print(*i)
for i in B:
    print(*i)

n = int(input())

w = [];a = [];b=[]

for i in range(n):

    w.append(list(map(int,input().split())))

    a.append(list(range(n)))

    b.append(list(range(n)))

for i in range(n):

    for j in range(n):

        a[i][j]=(w[i][j]+w[j][i])/2

        b[i][j]=(w[i][j]-w[j][i])/2

for i in range(n):

    for j in range(n):

        print('{0:0.8f}'.format(a[i][j]),end=' ')

    print()

for i in range(n):

    for j in range(n):

        print('{0:0.8f}'.format(b[i][j]),end=' ')

    print()



# Made By Mostafa_Khaled

n=int(input())
W=[[int(i) for i in input().split()] for _ in range(n)]
A=[[0 for __ in range(n)] for _ in range(n)]
B=[[0 for __ in range(n)] for _ in range(n)]
for i in range(n):
    for j in range(n):
        A[i][j]=(W[i][j]+W[j][i])/2
        A[j][i]=A[i][j]
        B[i][j]=W[i][j]-A[i][j]
        B[j][i]=-B[i][j]
for i in A:
    print(*i)
for i in B:
    print(*i)

import sys
n = int(sys.stdin.readline())
A = [[0]*n for i in range(n)]
for i in range(n):
    I = sys.stdin.readline().split()
    for j in range(n):
        A[i][j] = int(I[j])
B = [[0]*n for i in range(n)]
for i in range(n):
    for j in range(n):
        B[i][j] = (A[i][j]+A[j][i])/2
        print(B[i][j], end=" ")
    print()
for i in range(n):
    for j in range(n):
        print(A[i][j]-B[i][j], end=" ")
    print()


n = int(input())
W = [[int(s) for s in input().split()] for _ in range(n)]
A = [[0 for _ in range(n)] for _ in range(n)]
B  = [[0 for _ in range(n)] for _ in range(n)]

for i in range(n):
    for j in range(i, n):
        A[i][j] = (W[i][j] + W[j][i]) / 2
        A[j][i] = A[i][j]

        B[i][j] = (W[i][j] - W[j][i]) / 2
        B[j][i] = - B[i][j]

print('\n'.join([' '.join([str(i) for i in x]) for x in A]))
print('\n'.join([' '.join([str(i) for i in x]) for x in B]))

w = int(input())
a = [[]]*w
b = [[]]*w
for i in range(w):
    a[i] = list(map(int,input().split()))
    b[i] = [0]*w
for i in range(w):
    for j in range(w):
        if i < j:
            ac = (a[i][j] + a[j][i]) / 2
            b[j][i] = ac - a[i][j]
            b[i][j] = -1 * b[j][i]
            a[i][j] = a[j][i] = ac
for i in range(w):
    for j in range(w):
        print('%.8f'%a[i][j],end=' ')
    print('')
for i in range(w):
    for j in range(w):
        print('%.8f'%b[i][j],end=' ')
    print('')

n=int(input())
W=list()
for i in range(n):
    W.append([int(x) for x in input().split()])

A=[[0 for x in range(n)] for x in range(n)]
B=[[0 for x in range(n)] for x in range(n)]

#Diagonals
for i in range(n):
    B[i][i]=W[i][i]

#The rest
for i in range(n):
    for j in range(i,n):
        A[i][j]=(W[i][j]+W[j][i])/2
        B[i][j]=W[i][j]-A[i][j]
    for j in range(i):
        B[i][j]=-B[j][i]
        A[i][j]=A[j][i]

for i in range(n):
    print(" ".join(str(x) for x in A[i]))
for i in range(n):
    print(" ".join(str(x) for x in B[i]))


mat = []
num = int(input())
for k in range(num):
    s = input().split()
    mat.append(list(map(int, s)))
for k in range(num):
    for l in range(num):
        print('%.8f' % ((mat[k][l] + mat[l][k]) / 2), end=' ')
    print(end='\n')
for k in range(num):
    for l in range(num):
        print('%.8f' % ((mat[k][l] - mat[l][k]) / 2), end=' ')
    print(end='\n')


n = int(input())
w = [None]*n
for i in range(n):
    w[i] = [int(j) for j in input().strip().split(' ')]
        
for i in range(n):
    for j in range(n):
        val = w[i][j]
        if (i != j):
            val = (val+w[j][i])/2
        print('{:.8f}'.format(val), end=' ')
    print('')

for i in range(n):
    for j in range(n):
        val = 0
        if (i != j):
            val = w[i][j] - (w[i][j]+w[j][i])/2
        print('{:.8f}'.format(val), end=' ')
    print('')


size = int(input())
w = []

for enu in range(size):
    temp = input().split()
    w.append(list(map(int, temp)))
A = [[0 for i in range(size)] for j in range(size)]
B = [[0 for i in range(size)] for j in range(size)]
for i in range(size):
    for j in range(i, size):
        A[i][j] = (w[i][j] + w[j][i]) / 2
        B[i][j] = (w[i][j] - w[j][i]) / 2
        A[j][i] = A[i][j]
        B[j][i] = -B[i][j]
def pr(A):
    nonlocal size
    for i in range(size):
        for j in range(size - 1):
            print("%.8f" % A[i][j], end = ' ')
        print('%.8f' % A[i][-1])
pr(A)
pr(B)

size = int(input())
w = []

for enu in range(size):
    temp = input().split()
    w.append(list(map(int, temp)))
A = [[0 for i in range(size)] for j in range(size)]
B = [[0 for i in range(size)] for j in range(size)]
for i in range(size):
    for j in range(i, size):
        A[i][j] = (w[i][j] + w[j][i]) / 2
        B[i][j] = (w[i][j] - w[j][i]) / 2
        A[j][i] = A[i][j]
        B[j][i] = -B[i][j]
def pr(A):
    nonlocal size
    for row in A:
        for i in range(size):
            print("{0:.8f}".format(row[i]), end = sep(i))
def sep(i):
    nonlocal size
    if i >= size - 1:
        return '\n'
    else:
        return ' '
            
pr(A)
pr(B)

size = int(input())
w = []

for enu in range(size):
    temp = input().split()
    w.append(list(map(int, temp)))
A = [[0 for i in range(size)] for j in range(size)]
B = [[0 for i in range(size)] for j in range(size)]
for i in range(size):
    for j in range(i, size):
        A[i][j] = (w[i][j] + w[j][i]) / 2
        B[i][j] = (w[i][j] - w[j][i]) / 2
        A[j][i] = A[i][j]
        B[j][i] = -B[i][j]
def pr(A):
    nonlocal size
    for row in A:
        for i, entry in enumerate(row):
            print("{0:.8f}".format(entry), end = sep(i))
def sep(i):
    nonlocal size
    if i >= size - 1:
        return '\n'
    else:
        return ' '
            
pr(A)
pr(B)

n=int(input())
inData=[]
for i in range(n):
    x=list(map(int,input().split(" ")))
    inData.append(x)
A=[list(range(n)) for i in range(n)]
B=[list(range(n)) for i in range(n)]

for i in range(1,n+1):
    for j in range(1,n+1):
        if i==j:
            A[i-1][j-1]=inData[i-1][j-1]
            B[i-1][j-1]=0
        else:
            A[i-1][j-1]=(inData[i-1][j-1]+inData[j-1][i-1])/2
            B[i-1][j-1]=(inData[i-1][j-1]-inData[j-1][i-1])/2
            
for i in range(n):
    for j in range(n):
        print(str(A[i][j])+" ",end="")
    print()

for i in range(n):
    for j in range(n):
        print(str(B[i][j])+" ",end="")
    print()



n = int(input())
l = []
l1 = []
l2 = []
for i in range(n):
    k = list(map(int,input().split()))
    l.append(k)
    l1.append([0]*len(k))
    l2.append([0]*len(k))

for i in range(n):
    for j in range(n):
        l1[i][j] = (l[i][j]+l[j][i])/2
        l2[i][j] = (l[i][j]-l[j][i])/2

for i in range(n):
    print(*l1[i])
for i in range(n):
    print(*l2[i])




def __starting_point():
    n = int(input())
    w = []
    for i in range(n):
        w.append(list(map(int, input().split())))
    a=[]
    b=[]
    for i in range(n):
        a.append([0.0]*n)
        b.append([0.0]*n)
    for i in range(n):
        for j in range(i, n):
            a[i][j] = (w[i][j] + w[j][i]) / 2
            a[j][i] = a[i][j]
            b[i][j] = w[i][j] - a[i][j]
            b[j][i] = w[j][i] - a[j][i]
    for i in range(n):
        print(" ".join(list(map(str, a[i]))))
    for i in range(n):
        print(" ".join(list(map(str, b[i]))))

__starting_point()

def printMatrix(matrix):
    for matrixrow in matrix:
        row=''
        for value in matrixrow:
            row+=str(value)+' '
        print(row)
n=int(input())
w=[[0 for i in range(n)] for i in range(n)]
a=[[0 for i in range(n)] for i in range(n)]
b=[[0 for i in range(n)] for i in range(n)]
for i in range(n):
    row=input().split(' ')
    for e in range(n):
        w[i][e]=int(row[e])
for i in range(n):
    for e in range(n):
        a[e][i]=a[i][e]=(w[i][e]+w[e][i])/2
        b[e][i]=w[e][i]-a[e][i]
printMatrix(a)
printMatrix(b)

x = int(input())

l = list()
for i in range(x):
    l.append([int(a) for a in input().split()])

a, b = list(range(x)), list(range(x))
for i in range(x):
    a[i], b[i] = list(range(x)), list(range(x))
    for j in range(x):
        if i is j:
            a[i][j] = l[i][j]
            b[i][j] = 0
        else:
            a[i][j] = (l[i][j] + l[j][i]) / 2
            b[i][j] = l[i][j] - a[i][j]

for x in a:
    print(" ".join(["{:.8f}".format(float(i)) for i in x]))

for x in b:
    print(" ".join(["{:.8f}".format(float(i)) for i in x]))


n = int(input())
if n == 1:
    print(int(input()))
    print(0)
    return
arr = [list(map(int, input().split(' '))) for _ in range(n)]
a = [[0]*n for _ in range(n)]
b = [[0]*n for _ in range(n)]
for i in range(n):
    a[i][i] = arr[i][i]
for i in range(n):
    for j in range(i+1, n):
        a[i][j] =  (arr[i][j] + arr[j][i]) / 2
        a[j][i] =  (arr[i][j] + arr[j][i]) / 2
        b[i][j] =  (arr[i][j] - arr[j][i]) / 2
        b[j][i] = -(arr[i][j] - arr[j][i]) / 2
for i in a: print(*i)
for i in b: print(*i)


n=int(input())
arr=[]
for i in range(n):
	arr.append(list(map(int,input().split())))
a=[]
b=[]
for i in range(n):
	a.append([])
	b.append([])
	for j in range(n):
		a[i].append((arr[i][j]+arr[j][i])/2)
		b[i].append(arr[i][j]-a[i][j])
for i in range(n):
	print(*a[i])
for i in range(n):
	print(*b[i])


n =int(input())
W = []
A = []
B = []

for i in range(n):
	a = list(map(int,input().split()))
	W.append(a)
	A.append([0]*n)
	B.append([0]*n)

	
for i in range(n):
		for j in range(n):
			if i!=j:
				A[i][j] = (W[i][j]+W[j][i])/2
				B[i][j] = (W[i][j]-A[i][j])
			else:
				A[i][j] = W[i][j]

for i in range(n):
	for j in range(n):
		print(A[i][j],end = " ")
	print()

for i in range(n):
	for j in range(n):
		print(B[i][j],end = " ")
	print()