midsems-vs-mugstud
Source: hackerearth
Difficulty: UNKNOWN_DIFFICULTY

Problem :

The super aliens aka (MiDsEmS) have taken over the earth and the only people who can save earth are a species genetically engineered by humans called (MuGStUd) . You are also a part of this genetically perfect human race . But defeat is near with the matrix of life (DCPlUsPlUs) locked behind a BACK DOOR. The only way to get through the door is to provide it with the cube of life. 

The cube of life (A is the name given to the cube) is a very special cube of size N with numbers present at each 1 X 1 X 1 cell .

But MiDsEmS have distorted the cube in a very cruel way and in the place of the cube have put up a fake (B is the name given to the distorted cube). What they did is described bellow-

At any position say (i,j,k) in the distorted cube they stored the sum of all elements in the cuboid formed with (i,j,k) and (0,0,0) of the cube of life as the opposite vertices.

Now your task as the most elite hacker of MugStUd is to find the orignal cube of life and give it to unlock the back door.

But time is not with you and you have to be very quick.

So given the distorted matrix, you have to find the original cube of life.

In conclusion you are given a cube B such that at every point (i,j,k) of the cube B is described as below-

   for(c=0;c ≤ i;c++)
     for(c1=0;c1 ≤ j;c1++)
        for(c2=0;c2 ≤ k;c2++)
           B(i,j,k)=B(i,j,k)+A(c,c1,c2);

BOTH A and B are 0 indexed.

Input :

t-number of test cases. Each test case is described below.

The first line of each test case will have N.

Then next N^2 lines follow each containing N numbers.

The first line contains the numbers B(0,0,0,), B (0,0,1)... B(0,0,N-1). 

The second line will have B(0,1,0), B(0,1,1).... B(0,1,N-1)......

The N th line will have B(0,N-1,0), B(0,N-1,1).... B(0,N-1,N-1)

The (N+1) th line will have B(1,0,0), B(1,0,1).... B(1,0,N-1).... and so on.

Output :

Print the cube of life A in the same format as the input

The answer to every test case must be answered in a new line.

Constraints :

1 ≤ t ≤ 100

1 ≤ N ≤ 50

0 ≤ B(i , j , k) ≤ 10^6 

Probem Setter : Sandeep

Problem Tester : Shreyans

(By IIT Kgp HackerEarth Programming Club)

SAMPLE INPUT
1
2
1 2
3 4
5 6
7 8

SAMPLE OUTPUT
1 1
2 0
4 0
0 0