import java.util.*;
import java.lang.*;
import java.io.*;
class Ideone {
Scanner read
= new Scanner
(System.
in); int n = read.nextInt(); //ввод из стандартного потока
double A[][] = new double [n][n];
double B[][] = new double [n][n];
double Z[][] = new double [n][n];
double H[][] = new double [n][n];
double E[][] = new double [n][n];
double C[][] = new double [n][n];
double Ans[][] = new double [n][n];
for (int i = 0; i < n; i++){ //матрица А
for (int j = 0 ; j < n ; j++){
A[i][j] = read.nextDouble();
}
}
for (int i = 0; i < n; i++){ //матрица В
for (int j = 0 ; j < n ; j++){
B[i][j] = read.nextDouble();
}
}
for (int i = 0; i < n; i++){ //единичная матрица Е
for (int j = 0 ; j < n ; j++){
if (i == j) E[i][j] = 1;
else E[i][j] = 0;
}
}
for (int i = 0; i < n; i++){ //разность матриц В и Е
for (int j = 0; j < n; j++){
Z[i][j] = 0;
Z[i][j] = B[i][j] - E[i][j];
}
}
for (int i = 0; i < n; i++){ //умножение матриц А и (В - Е)
for (int j = 0; j < n; j++){
H[i][j] = 0;
for (int t = 0; t < n; t++){
H[i][j] += A[i][t] * Z[t][j];
}
}
}
for (int i = 0; i < n; i++){ //матрица С
for (int j = 0; j < n; j++){
C[i][j] = 0;
C[i][j] = 1.0/((i+1)+(j+1));
}
}
for (int i = 0; i < n; i++){ //матрица A(B–E)+C
for(int j = 0; j < n; j++){
Ans[i][j] = H[i][j] + C[i][j];
System.
out.
print(Ans
[i
][j
] + " "); }
}
}
}