Coal Mine

아직 제출이 없습니다시간 제한0.5초메모리 제한64 MB

문제

There was a strike at a coal mine in Bytesia recently. Angry miners destroyed all the mine's data. You were hired to recover some data on what types of coal were mined in different parts of the mine.

The company mines kk different coal types. The coal mine is a rectangular grid. Every unit square of the grid is an area that mines exactly one type of coal. On some midpoints of edges of the unit squares, there are elevators, one for each of the kk coal types being mined in the mine. As a coal mine must be a work of art, the set of unit squares where coal of type ii is mined at is symmetric with respect to the point where the elevator assigned to coal type ii is located.

You are given the dimensions of the coal mine, the number kk and the locations of the kk elevators. Your task is to determine a way of assigning unit squares to coal types so the above conditions are met, or to determine that such an assignment does not exist.

입력

The first line of input consists of one integer zz, the number of test cases. Then, zz test cases proceed, described in the following way.

The first line of each test case description consists of three integers nn, mm amd kk (1n,m1 \leq n, m, nm1,500n \cdot m \leq 1\\,500, 1k1001 \leq k \leq 100): the dimensions of the coal mine and the number of different coal types mined in the mine. The upper-left corner of the upper-left field of the mine has coordinates (0,0)(0, 0), and the lower-right corner of the lower-right field has coordinates (n,m)(n, m).

Then the locations of kk elevators follow, each one being represented as a line containing the coordinates of the elevator ii, jj (0in0 \leq i \leq n, 0jm0\leq j \leq m). Exactly one of i,ji, j is an integer and the other one is a half of an integer, representing a point on a  grid's unit square edge. The ll-th (11-based) of the elevators is assigned to coal type ll.

출력

For each test case, you must first output a single line containg a word "YES" if there exists a proper assignment of coal types to \textbf{all} grid's unit squares, or "NO" if such an assignment does not exist. Additionally, if such an assignment exists, you must then output nn lines, each containg mm integers separated by spaces. The jj-th number in the ii-th (11-based) line must be an integer describing the coal type mined at square with upper-left coordinate of (i1,j1)(i - 1, j - 1) and lower-right of (i,ji, j). Coal types are denoted by integers from 11 to kk. If there are several possible answers, print any one of them.