K. Construct Matching
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

"Given a complete bipartite graph with $$$n$$$ vertices on the left part and $$$m$$$ vertices on the right part, where each edge is colored with one of $$$k$$$ colors. Determine the maximum matching for each color separately."

Now, the reverse task. Constructing a complete bipartite graph with $$$n$$$ and $$$m$$$ vertices on the left and right parts respectively, and assigning colors to edges in such a way that the maximum matching for each color corresponds to the given values $$$c_1, c_2, \ldots, c_k$$$.

Input

The first line contains one integer $$$T$$$ $$$(1 \le T \le 10^4)$$$ — the number of test cases.

The first line of each test case contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ $$$(1 \le n, m \le 100, 1 \le k \le n \cdot m)$$$ — the number of vertices on the left and right parts respectively and the number of colors.

The second line contains $$$k$$$ integers $$$c_1, c_2, \ldots, c_k$$$ $$$(1 \le c_i \le 10 ^ 9)$$$ — the maximum matching for each color.

It is guaranteed that the sum of $$$n \cdot m$$$ over all test cases does not exceed $$$10^4$$$.

Output

For each test case, output "NO" if it is not possible to construct such a graph.

Otherwise, output in the first line "YES", and then provide the required graph.

In each of the first $$$n$$$ lines of graph description, output $$$m$$$ integers. The $$$j$$$-th integer in the $$$i$$$-th line denotes the color of the edge between nodes $$$i$$$ on the left part and $$$j$$$ on the right part.

Example
Input
5
1 2 2
1 1
3 3 9
1 1 1 1 1 1 1 1 1
3 3 2
10 10
3 3 1
3
2 2 3
1 2 1
Output
YES
1 2 
YES
1 4 7 
8 2 5 
6 9 3 
NO
YES
1 1 1 
1 1 1 
1 1 1 
YES
2 1 
3 2