Recently, LBH is learning the curse linear algebra. Thus he is very interested in matrix and determinant now. In order to practice his ability of solving the problem of linear algebra, he just invent some problems by himself. Once the problems was create, he would solve it immediately. However, he meet a problem that was so hard that he couldn't work out even though racked his brains. The problem was described as follow:

To a integer martix M_{nn}(a_{ij}), we define two function add(M_{nn}(a_{ij}))=M_{nn}(a_{ij} + 1) and sub(M_{nn}(a_{ij}))=M_{nn}(a_{ij} - 1) which were exactly like this:

According to the martix M_{nn}(a_{ij}), we can permutate it and get a full permutation set Perm(M_{nn}(a_{ij})) = {M_{nn}(a_{IiJj})| I and J is a permutation of 1..n }, (Perm(M) is a set, each matrix in Perm(M) is unique). For example:

The problem is to get the result of a fomula about an integer matrix M_{nn}:

There are several test cases.

The first line contains an integer `T`(`T` ≤ 100) .
Then `T` test cases follow.

In each test case, the first line contains one integer `n`(0<
`n`≤ 10). The number means the giving matrix's size is `n×n`

Then there are `n` lines followed, each line contains `n`
integers `a _{ij}`(-10≤

提交代码