It is a well-known fact in the problemsetting room: Fofo absolutely despises trees, and Jamal harbors an intense hatred for grids. Naturally, the room was left in stunned silence when Fofo, with a mischievous grin, unexpectedly proposed a tree problem.
Before the ink could even dry, Jamal narrowed his eyes and hit him with a swift, merciless $$$\texttt{3rr}$$$.
"Project it onto a grid," Jamal demanded.
After a fierce clash of wills, a compromise was born. What lies before you is the ultimate cocktail of Jamal and Fofo's $$$\texttt{7as7aseh}$$$—a grid problem haunted by the ghost of a tree.
Consider an $$$n \times m$$$ grid. A path is a sequence of cells moving exclusively down or to the right, starting and ending at distinct positions. The length of a path is the total number of cells it traverses.
Your challenge is to survive their $$$\texttt{7as7aseh}$$$ by filling the grid with positive integers such that it satisfies one core property: for every path of length $$$L$$$, at least two cells along that path must contain values divisible by $$$L$$$.
If their combined trap is too strong and no such valid grid exists, report that it is impossible.
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases.
Each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n,m \le 300$$$) — the number of rows and columns.
It is guaranteed that the sum of $$$n \cdot m$$$ over all test cases does not exceed $$$90000$$$.
For each test case, print NO if it is impossible to construct a valid grid.
Otherwise, print YES, followed by $$$n$$$ lines. Each of these lines must contain $$$m$$$ integers, the values in the grid. Every value must be between $$$1$$$ and $$$10^9$$$, inclusive.
You may print YES and NO in any case. If there are several valid grids, print any of them.
31 11 32 2
YES 1000000000 YES 6 6 6 YES 12 6 6 12
The provided sample illustrates just one possible valid configuration.
In the first test case, there does not exist any path starting and ending at distinct positions. Hence, any grid works.