| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 88 | 37 | 24 | 35.821% |
Grammy has an $n \times m$ wall covered by squares. Each small square on the wall is of unit size and should be painted into one color completely. She wants to color the wall into black and white. Grammy likes the concept of diversity, so she decided to make each row look different from all previous rows and also make each column look different from all previous columns. As she was about to paint, she found her paint was just enough: half of white paint and half of black paint, both with an amount to paint exactly $\frac{nm}{2}$ unit area. Please help Grammy to satisfy her diversity condition using limited paint.
The input contains multiple test cases.
The first line contains a single integer $T$ ($1 \leq T \leq 2000$), denoting the number of test cases.
For each test case:
The only line contains two integers $n$ and $m$ ($1 \leq n,m \leq 1000$). It is guaranteed that the sum of $n \cdot m$ does not exceed $10^6$.
For each test case, if no solution exists, output "NO". Otherwise, output "YES" followed by $n$ lines. Each line should contain $m$ characters. $0$ denotes a white square and $1$ denotes a black square in the solution.
5 1 1 2 2 2 4 4 4 5 10
NO YES 10 01 YES 1100 0110 YES 1100 0110 0000 1111 YES 1111100000 0101010101 0011011001 0000111110 1111000001