Matrices and Determinants
시간 제한1초메모리 제한2048 MB
작은 정수 행렬 A마다 행렬식이 0이 아니고 서로 같은 두 행렬 B, C의 곱으로 나타낼 수 있는지 판정하고, 가능하면 그러한 B와 C를 출력한다.
문제
Given an integer matrix , you should find two integer matrices and such that and . There may exist multiple solutions or no solution.
Note: denotes the determinant of matrix .
입력
The first line contains one integer () denoting the number of test cases. For each test case:
The first line contains one integer () denoting the size of the given matrix.
In the following lines, the -th line contains integers ( for ) 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 lines contains integers () denoting the matrix .
Each of the following lines contains integers () denoting the matrix .
If multiple solutions exist, print any one of them.