You have n · m square tiles, each painted with a color codified with a number. You will have to use the tiles to cover a floor of dimensions n × m, with just one restriction: there cannot be two or more (horizontal or vertical) adjacent tiles of the same color. Can you find a solution?
Input
Input consists of several cases, each with n and m, followed by n · m numbers, all between 1 and n · m. Assume 1 ≤ n · m ≤ 105.
Output
For each case, if there is no solution, print a line with “NO”. Otherwise, print a line with “YES”, followed by n lines with m numbers each. If there is more than one solution, you can print any one. Follow strictly the format of the sample output.
Input
2 3 6 1 1 4 4 6 2 3 6 1 1 4 4 6 2 3 6 6 6 6 2 2 4 4 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 1 11 1 2 3 4 5 6 7 8 9 10 11
Output
YES 1 4 6 6 1 4 YES 6 4 1 4 1 6 NO YES 4 3 2 1 3 1 4 3 1 2 3 1 2 4 2 4 YES 5 11 4 6 3 7 2 8 10 9 1