시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB29201967.857%

문제

A Hadamard matrix of order n is an n × n matrix containing only 1s and -1s, called Hn, such that $$H_nH_n^T = nI_n$$ where In is the n × n identity matrix. An interesting property of Hadamard matrices is that they have the maximum possible determinant of any n × n matrix with elements in the range [−1,1]. Hadamard matrices have applications in error- correcting codes and weighing design problems.

The Sylvester construction is a way to create a Hadamard matrix of size 2n given Hn. H2n can be constructed as:

$$H_{2n} = \begin{pmatrix} H_n & H_n \\ H_n & -H_n \end{pmatrix}$$

For example:

H1 = (1)

$$H_2 = \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}$$

and so on.

In this problem you are required to print a part of a Hadamard matrix
constructed in the way described above.

입력

The first number in the input is the number of test cases to follow. For each test case there are five integers: n, x, y, w and h. n will be between 1 and 262 (inclusive) and will be a power of 2. x and y specify the upper left corner of the sub matrix to be printed, w and h specify the width and height respectively. Coordinates are zero based, so 0 ≤ x,y < n. You can assume that the sub matrix will fit entirely inside the whole matrix and that 0 < w,h ≤ 20. There will be no more than 1000 test cases.

출력

For each test case print the sub matrix followed by an empty line.

예제 입력 1

3
2 0 0 2 2
4 1 1 3 3
268435456 12345 67890 11 12


예제 출력 1

1 1
1 -1

-1 1 -1
1 -1 -1
-1 -1 1

1 -1 -1 1 1 -1 -1 1 1 -1 -1
-1 -1 1 1 -1 -1 1 1 -1 -1 1
1 1 1 -1 -1 -1 -1 1 1 1 1
-1 1 -1 -1 1 -1 1 1 -1 1 -1
1 -1 -1 -1 -1 1 1 1 1 -1 -1
-1 -1 1 -1 1 1 -1 1 -1 -1 1
-1 -1 -1 -1 -1 -1 -1 1 1 1 1
1 -1 1 -1 1 -1 1 1 -1 1 -1
-1 1 1 -1 -1 1 1 1 1 -1 -1
1 1 -1 -1 1 1 -1 1 -1 -1 1
-1 -1 -1 1 1 1 1 1 1 1 1
1 -1 1 1 -1 1 -1 1 -1 1 -1