시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB93233.333%

문제

Given an $n \times n$ integer matrix $A$, you should find two $n \times n$ integer matrices $B$ and $C$ such that $B \cdot C = A$ and $\mathrm{det}(B) = \mathrm{det}(C) \neq 0$. There may exist multiple solutions or no solution.

Note: $\mathrm{det}(M)$ denotes the determinant of matrix $M$.

입력

The first line contains one integer $T$ ($1 \le T \le 10\,000$) denoting the number of test cases. For each test case:

The first line contains one integer $n$ ($1 \le n \le 4$) denoting the size of the given matrix.

In the following $n$ lines, the $i$-th line contains $n$ integers $A_{i,j}$ ($|A_{i,j}| \le 10$ for $1 \le j \le n$) denoting the given matrix.

출력

For each test case:

The first line must contain one string "Yes" (without quotes) if a solution exists, or "No" (without quotes) if there is no solution. If a solution exists:

Each of the following $n$ lines contains $n$ integers $B_{i,j}$ ($|B_{i,j}| \le 10^{18}$) denoting the matrix $B$.

Each of the following $n$ lines contains $n$ integers $C_{i,j}$ ($|C_{i,j}| \le 10^{18}$) denoting the matrix $C$.

If multiple solutions exist, print any one of them.

예제 입력 1

3
2
2 0
0 2
2
2 1
1 2
1
1

예제 출력 1

Yes
2 0
0 1
1 0
0 2
No
Yes
-1
-1