#K52657. Mirrored Square Matrix

    ID: 29358 Type: Default 1000ms 256MiB

Mirrored Square Matrix

Mirrored Square Matrix

Given an integer n, construct an n × n mirrored square matrix A such that:

\(A_{ij} = \begin{cases} 12, & \text{if } i=j \\ 11, & \text{if } i\neq j \end{cases}\)

This means the diagonal elements are 12 and all off-diagonal elements are 11. Although the problem statement mentions that the sum of each row and column should be a non‐prime number, you only need to build the matrix as described above.

For example, when n = 3, the expected matrix is:

12 11 11
11 12 11
11 11 12

Your task is to read multiple test cases from the standard input and, for each test case, output the corresponding mirrored square matrix. Each matrix should be separated by a blank line (except after the last one).

inputFormat

The input is given via standard input (stdin) in the following format:

T
n1
n2
... 
 nT

Here, T is the number of test cases. Each subsequent line contains one integer n representing the size of the mirrored square matrix for that test case.

outputFormat

For each test case, output the generated n × n matrix. Each row should be printed on a new line with the elements separated by a single space. After each test case (except the last one), print an empty line to separate the matrices.

## sample
1
2
12 11

11 12

</p>