System of equations
Consider a system of N equations, where the k-th equation is expressed as:
[ X + Y = b_k ]
Here, X is defined as (x_1k + x_2k + ...+ x_k-1, k), and Y is defined as (x_k, k+1 + ...+ x_kN). Therefore, the left side of each equation consists of (N-1) terms, and each unknown variable appears in exactly two equations of the system.
Your task is to write a program named SYSTEM that, given the values b_1, ..., b_N, finds a solution to the system where the unknowns (x_ij) can only be either 0 or 1.
Input
The first line of the input file contains a natural number indicating the number of test cases. Each test case starts with a line containing the number N (3 ≤ N ≤ 50), which represents the number of equations in the system. The second line of each test case provides N integers b_i (0 ≤ b_i ≤ 50).
Output
For each test case, the output should consist of one of the solutions to the system: (N-1) lines, where each k-th line contains N-k numbers representing the values of the unknowns:
[ x_12 ...x_1N ]
[ x_23 ...x_2N ]
[ x_34 ...x_3N ]
[ ...]
[ x_N-1, N ]
If a test case has no solution, the output should be a single line containing the number -1.