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

Source: codeforces | Difficulty: MEDIUM


Solutions:
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)


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)))


def transpose(m, d):
	new = []
	for i in range(d):
		new.append([m[j][i] for j in range(d)])
	return new

def sum(a, b, dim):
	new = []
	for i in range(dim):
		new.append([(a[i][j] + b[i][j]) / 2 for j in range(dim)])
	return new

def diff(a, b, dim):
	new = []
	for i in range(dim):
		new.append([(a[i][j] - b[i][j]) / 2 for j in range(dim)])
	return new

def print_matrix(a, dim):
	for i in range(dim):
		row = ''
		for j in range(dim):
			row += str(a[i][j])
			row += ' '
		print(row)
dim = int(input())
w = []
for _ in range(dim):
	w.append([int(i) for i in input().split()])
wt = transpose(w, dim)
print_matrix(sum(w, wt, dim), dim)
print_matrix(diff(w, wt, dim), dim)


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):
	print(*A[i])
for i in range(n):
	print(*B[i])


n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
b = [[0 for j in range(n)] for i in range(n)]
c = [[0 for j in range(n)] for i in range(n)]
for i in range(n):
	for j in range(i, n):
		if i == j:
			b[i][j] = a[i][j] / 1
		else:
			x = (a[i][j] + a[j][i]) / 2
			b[i][j] = x
			b[j][i] = x
			c[i][j] = a[i][j] - x
			c[j][i] = a[j][i] - x
for i in b:
	for j in i:
		print('{0:.8f}'.format(j), end=' ')
	print()
for i in c:
	for j in i:
		print('{0:.8f}'.format(j), end=' ')
	print()


n = int(input())
w = []
for i in range(n):
	wi = [int(x) for x in input().split()]
	w.append(wi)
a = []
b = []
for i in range(n):
	r1 = []
	r2 = []
	for j in range(n):
		if i < j:
			a1 = (w[i][j] + w[j][i]) / 2
			b1 = (w[i][j] - w[j][i]) / 2
		elif i > j:
			a1 = (w[i][j] + w[j][i]) / 2
			b1 = (w[i][j] - w[j][i]) / 2
		else:
			a1 = w[i][j]
			b1 = 0
		r1.append(a1)
		r2.append(b1)
	a.append(r1)
	b.append(r2)
for i in range(n):
	print(*a[i])
for i in range(n):
	print(*b[i])


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):
	global size
	for row in A:
		for (i, entry) in enumerate(row):
			print('{0:.8f}'.format(entry), end=sep(i))

def sep(i):
	global size
	if i >= size - 1:
		return '\n'
	else:
		return ' '
pr(A)
pr(B)


n = int(input())
matrix = []
a = n
while a > 0:
	x = []
	x = input().split()
	matrix.append(x)
	a -= 1
a = 0
while a < n:
	b = 0
	out = ''
	while b < n:
		if a == b:
			if b == 0:
				out = str(float(matrix[a][b]))
			else:
				out += ' ' + str(float(matrix[a][b]))
		elif b == 0:
			out = str((float(matrix[a][b]) + float(matrix[b][a])) / 2)
		else:
			out += ' ' + str((float(matrix[a][b]) + float(matrix[b][a])) / 2)
		b += 1
	print(out)
	a += 1
a = 0
while a < n:
	b = 0
	out = ''
	while b < n:
		if a == b:
			if b == 0:
				out = str(float(0))
			else:
				out += ' ' + str(float(0))
		elif b == 0:
			out = str((float(matrix[a][b]) - float(matrix[b][a])) / 2)
		else:
			out += ' ' + str((float(matrix[a][b]) - float(matrix[b][a])) / 2)
		b += 1
	print(out)
	a += 1


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


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]))


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)


n = int(input())
a = []
for i in range(n):
	a.append(list(map(int, input().split())))
b = [[0] * n for _ in range(n)]
c = [[0] * n for _ in range(n)]
for i in range(n):
	for j in range(n):
		if i == j:
			b[i][j] = a[i][j]
		else:
			k = a[i][j] + a[j][i]
			b[i][j] = k / 2
			b[j][i] = k / 2
			c[i][j] = a[i][j] - b[i][j]
			c[j][i] = a[j][i] - b[j][i]
for i in range(n):
	for j in range(n):
		print(b[i][j], end=' ')
	print()
for i in range(n):
	for j in range(n):
		print(c[i][j], end=' ')
	print()


n = int(input())
mat = []
for k in range(0, n):
	mat.append(list(map(int, input().rstrip().split())))
A = mat
B = [[0] * n for _ in range(n)]
for i in range(1, n):
	for j in range(0, i):
		a = (mat[i][j] + mat[j][i]) / 2
		b = mat[j][i] - a
		A[i][j] = a
		B[i][j] = -b
		A[j][i] = a
		B[j][i] = b
for i in range(n):
	print(*A[i])
for i in range(n):
	print(*B[i])


n = int(input())
if n == 1:
	print(int(input()))
	print(0)
	exit()
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())
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])


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('')


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]))))


n = int(input())
matrix = []
for i in range(n):
	listA = input().split()
	for i in range(0, len(listA)):
		listA[i] = int(listA[i])
	matrix.append(listA)
matAt = [[0 for x in range(n)] for y in range(n)]
matBt = [[0 for x in range(n)] for y in range(n)]
for i in range(n):
	for j in range(n):
		matAt[i][j] = matrix[j][i]
		matAt[i][j] = float(matAt[i][j] + matrix[i][j]) / 2
for i in range(n):
	for j in range(n):
		matBt[i][j] = 0 - matrix[j][i]
		matBt[i][j] = float(matBt[i][j] + matrix[i][j]) / 2
for i in range(n):
	print(*matAt[i])
for i in range(n):
	print(*matBt[i])


n = int(input())
mat = []
for i in range(n):
	l = list(map(int, input().split()))
	mat.append(l)
x = [[False] * n for i in range(n)]
y = [[False] * n for i in range(n)]
for i in range(n):
	for j in range(n):
		if x[i][j] == False:
			k = mat[i][j] + mat[j][i]
			x[i][j] = k / 2
			x[j][i] = k / 2
for i in range(n):
	for j in range(n):
		if y[i][j] == False:
			if mat[i][j] > x[i][j]:
				y[i][j] = -(x[i][j] - mat[i][j])
				y[j][i] = x[i][j] - mat[i][j]
			elif mat[i][j] == x[i][j]:
				y[i][j] = mat[i][j] - x[i][j]
				y[j][i] = mat[i][j] - x[i][j]
			else:
				y[i][j] = mat[i][j] - x[i][j]
				y[j][i] = -(mat[i][j] - x[i][j])
for i in range(n):
	for j in range(n):
		print('%.8f' % x[i][j], end=' ')
	print('')
for i in range(n):
	for j in range(n):
		print('%.8f' % y[i][j], end=' ')
	print('')


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()


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())
ans = [list(map(int, input().split(' '))) for x in range(n)]
a = [[0 for x in range(n)] for x in range(n)]
b = [[0 for x in range(n)] for x in range(n)]
for x in range(n):
	for y in range(n):
		if x == y:
			a[x][y] = ans[x][y]
		else:
			a[x][y] = (ans[x][y] + ans[y][x]) / 2
			b[x][y] = (ans[x][y] - ans[y][x]) / 2
for x in a:
	print(*x)
for y in b:
	print(*y)


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]))


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()


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)]
for i in range(n):
	B[i][i] = W[i][i]
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])))


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)


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]))


W = []
for _ in range(int(input())):
	W.append(list(map(int, input().split())))
(a, b) = ([], [])
for i in range(len(W)):
	(t1, t2) = ([], [])
	for j in range(len(W)):
		(t1.append((W[i][j] + W[j][i]) / 2), t2.append((W[i][j] - W[j][i]) / 2))
	(a.append(t1), b.append(t2))
list(map(lambda x: print(*x), a + b))


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


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

def print_matrix(A):
	for i in A:
		for j in i:
			print(j, end=' ')
		print()
for i in range(n):
	row_input = input()
	row_list = row_input.split()
	new_row_list = []
	for j in row_list:
		new_row_list.append(float(j))
	W.append(new_row_list)
a = [row[:] for row in W]
b = [row[:] for row in W]
for j in range(n):
	for i in range(n):
		if i == j:
			b[j][i] = W[j][i] - a[j][i]
			continue
		a[j][i] = (W[j][i] + W[i][j]) / 2.0
		b[j][i] = W[j][i] - a[j][i]
print_matrix(a)
print_matrix(b)


def Add(string):
	l = string.split('.')
	s = l[1]
	if len(s) < 8:
		s1 = '0'
		s1 = s1 * (8 - len(s))
		s += s1
	elif len(s) >= 8:
		s = s[:8]
	string = l[0] + '.' + s
	return string
n = int(input())
li = []
for i in range(n):
	string = input()
	l = string.split()
	for j in range(len(l)):
		l[j] = int(l[j])
	li.append(l)
A = []
for i in range(n):
	l = [0]
	l = l * n
	A.append(l)
B = []
for i in range(n):
	l = [0]
	l = l * n
	B.append(l)
for i in range(n):
	A[i][i] = float(li[i][i])
for i in range(n):
	for j in range(0, i + 1):
		if i != j:
			k = li[j][i] - li[i][j]
			k = k / 2
			A[j][i] = float(li[j][i]) - k
			A[i][j] = float(li[i][j]) + k
			B[j][i] = float(B[j][i]) + k
			B[i][j] = float(B[i][j]) - k
for i in range(n):
	for j in range(n):
		A[i][j] = Add(str(float(A[i][j])))
		B[i][j] = Add(str(float(B[i][j])))
for i in range(n):
	string = ''
	for j in range(n):
		string += A[i][j] + ' '
	print(string)
for i in range(n):
	string = ''
	for j in range(n):
		string += B[i][j] + ' '
	print(string)


n = int(input())
W = []
for i in range(0, n):
	s = input().split(' ')
	w = list(map(int, s))
	W.append(w)
a = []
b = []
A = []
B = []
i = 0
while i < n:
	for j in range(0, n):
		if i == j:
			a.append(W[i][j])
			b.append(0)
		elif i < j:
			a.append((W[i][j] + W[j][i]) / 2)
			b.append((W[i][j] - W[j][i]) / 2)
		else:
			a.append((W[j][i] + W[i][j]) / 2)
			b.append((W[i][j] - W[j][i]) / 2)
	i += 1
s = []
for i in range(0, len(a)):
	if (i + 1) % n == 0:
		s.append(a[i])
		print(*s, sep=' ')
		s = []
	else:
		s.append(a[i])
s = []
for i in range(0, len(b)):
	if (i + 1) % n == 0:
		s.append(b[i])
		print(*s, sep=' ')
		s = []
	else:
		s.append(b[i])


n = int(input())
l = [[0.0] * n for i in range(n)]
for i in range(0, n):
	l[i] = list(map(float, input().split()))
a = [[0.0] * n for i in range(n)]
b = [[0.0] * n for i in range(n)]
for i in range(0, n):
	for j in range(0, i + 1):
		if i == j:
			a[i][j] = l[i][j]
			b[i][j] = 0
		elif i > j:
			a[i][j] = (l[i][j] + l[j][i]) / 2
			a[j][i] = a[i][j]
			b[i][j] = (l[i][j] - l[j][i]) / 2
			b[j][i] = -1 * b[i][j]
for i in range(n):
	print(*a[i])
for i in range(n):
	print(*b[i])


n = int(input())
l = []
for i in range(n):
	c = list(map(int, input().split()))
	l.append(c)
a = []
b = []
for i in range(n):
	a.append([-99999] * n)
	b.append([-99999] * n)
for i in range(n):
	for j in range(n):
		if i == j:
			a[i][j] = l[i][j]
			b[i][j] = 0
		elif a[i][j] == -99999:
			a[i][j] = a[j][i] = (l[i][j] + l[j][i]) / 2
			b[i][j] = (l[i][j] - l[j][i]) / 2
			b[j][i] = -1 * (l[i][j] - l[j][i]) / 2
for i in a:
	for j in i:
		print(j, end=' ')
	print()
for i in b:
	for j in i:
		print(j, end=' ')
	print()


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())
mat = []
for i in range(n):
	temp = list(map(int, input().split()))
	mat.append(temp)
(a, b) = ([], [])
for i in range(n):
	x = []
	for j in range(n):
		if i == j:
			v = '{0:.8f}'.format(mat[i][j])
			x.append(v)
		else:
			v = '{0:.8f}'.format((mat[i][j] + mat[j][i]) / 2)
			x.append(v)
	a.append(x)
for i in range(n):
	x = []
	for j in range(n):
		if i == j:
			v = '{0:.8f}'.format(0)
			x.append(v)
		else:
			v = '{0:.8f}'.format(mat[i][j] - float(a[i][j]))
			x.append(v)
	b.append(x)
for i in a:
	print(*i)
for i in b:
	print(*i)


n = int(input())
array = [0] * n
for i in range(n):
	arr = input().split()
	arr = list(map(lambda x: int(x), arr))
	array[i] = arr
for i in range(n):
	for j in range(n):
		if i == j:
			print(array[i][j], end=' ')
		else:
			print((array[i][j] + array[j][i]) / 2, end=' ')
	print('')
for i in range(n):
	for j in range(n):
		if i == j:
			print('0', end=' ')
		elif i > j:
			print((array[i][j] - array[j][i]) / 2, end=' ')
		else:
			print((array[i][j] - array[j][i]) / 2, end=' ')
	print('')


def code():
	mat = []
	n = int(input())
	for i in range(n):
		t = input().split()
		mat.append(list(map(int, t)))
	for i in range(n):
		for j in range(n):
			print('%.8f' % ((mat[i][j] + mat[j][i]) / 2), end=' ')
		print()
	for i in range(n):
		for j in range(n):
			print('%.8f' % ((mat[i][j] - mat[j][i]) / 2), end=' ')
		print()
code()


n = int(input())
a = [[] for i in range(n)]
arr1 = [[None for i in range(n)] for i in range(n)]
arr2 = [[None for i in range(n)] for i in range(n)]
for i in range(n):
	x = [int(x) for x in input().split()]
	for item in x:
		a[i].append(item)
for i in range(n):
	for j in range(n):
		arr1[i][j] = float(a[i][j] + a[j][i]) / 2
		arr2[i][j] = float(a[i][j] - a[j][i]) / 2
for i in range(n):
	print(*arr1[i])
for i in range(n):
	print(*arr2[i])


import math
import cmath
n = int(input())
w = []
a = []
b = []
for _ in range(n):
	w.append(list(map(int, input().split())))
	a.append([0.0] * n)
	b.append([0.0] * n)
for x in range(n):
	a[x][x] = 1.0 * w[x][x]
	for y in range(x):
		a[x][y] = a[y][x] = (w[x][y] + w[y][x]) / 2
		b[x][y] = w[x][y] - a[x][y]
		b[y][x] = -b[x][y]
for x in range(n):
	for y in range(n):
		print(a[x][y], end=' ')
	print('')
for x in range(n):
	for y in range(n):
		print(b[x][y], end=' ')
	print('')


def printMat(matrix):
	for i in range(n):
		for j in range(n):
			print('{:.8f}'.format(matrix[i][j]), end=' ')
		print()
n = int(input())
mat = []
for k in range(0, n):
	mat.append(list(map(int, input().rstrip().split())))
A = mat
B = [[0] * n for _ in range(n)]
for i in range(1, n):
	for j in range(0, i):
		a = (mat[i][j] + mat[j][i]) / 2
		b = mat[j][i] - a
		A[i][j] = a
		B[i][j] = -b
		A[j][i] = a
		B[j][i] = b
printMat(A)
printMat(B)


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)


import sys
from os import path
from collections import Counter
if path.exists('inp.txt'):
	sys.stdin = open('inp.txt', 'r')
	sys.stdout = open('out.txt', 'w')
import math
n = int(input())
w = []
li = [0] * (2 * n - 1)
for i in range(n):
	temp = list(map(int, input().split()))
	w.append(temp)
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):
		a[i][j] = (w[i][j] + w[j][i]) / 2
		b[i][j] = (w[i][j] - w[j][i]) / 2
for i in a:
	print(*i)
for i in b:
	print(*i)


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())
w = []
for i in range(n):
	w.append([int(i) for i in input().split()])
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):
	a[i][i] = w[i][i]
for i in range(n - 1):
	for j in range(i + 1, n):
		x = (w[i][j] + w[j][i]) / 2
		y = (w[i][j] - w[j][i]) / 2
		a[i][j] = x
		a[j][i] = x
		b[i][j] = y
		b[j][i] = -y
for i in a:
	for j in i:
		print(j, '', end='')
	print()
for i in b:
	for j in i:
		print(j, '', end='')
	print()


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])