아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Painting Grid

시간 제한1초메모리 제한1024 MB

요약
n×m 격자마다 검은 칸이 정확히 절반이고 모든 행과 열이 서로 다른 흑백 배색이 존재하는지 판정하고, 존재하면 하나를 출력한다.
난이도

보통10점 중 6점

유형
구현, 조합론, 수학, 완전 탐색
정답자
아직 제출이 없습니다

문제

Grammy has an n×mn \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 nm2\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 TT (1≤T≤20001 \leq T \leq 2000), denoting the number of test cases.

For each test case:

The only line contains two integers nn and mm (1≤n,m≤10001 \leq n,m \leq 1000). It is guaranteed that the sum of n⋅mn \cdot m does not exceed 10610^6.

출력

For each test case, if no solution exists, output "NO". Otherwise, output "YES" followed by nn lines. Each line should contain mm characters. 00 denotes a white square and 11 denotes a black square in the solution.

예제1

  1. 예제 1

    입력
    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