Progressive Art

Time limit: 0.18s Memory limit: 256MB Input: Output:

Carlo is a big fan of progressive music and he recently found out that progressive paintings exist too! Clearly, he wants to dive into it, therefore he hired you as his assistant. A progressive painting is made using Vim, and consists of a rectangle of N×MN \times M coloured square cells. Since Carlo wants to be even more progressive, he only uses the colors red, green, and blue.

Carlo has a weird way of judging the beauty of his works. He invented a measure called LL-beauty. A square of size LL (that is, consisiting of L×LL\times L contiguous cells of the painting) is beautiful if it contains an equal number of red, green, and blue cells. The LL-beauty of the painting is the number of beautiful squares of size LL in it.

Task

Carlo asked you a question to test your skill. Given NN, MM, LL and KK, does a painting with NN rows, MM columns, and an LL-beauty equal to KK exist? If so, could you paint one for him?

Input data

The input file consists of a single line, containing the integers NN, MM, LL, and KK.

Output data

If it is possible to produce a suitable painting, you have to output N+1N + 1 lines:

  • One line containing the string YES.
  • NN lines, each containing a string of length MM, consisting of R, G, and B only, representing red, green, and blue cells in the painting.

If it is not possible to do so, you have to output a single line containing the string NO.

Constraints and clarifications

  • 1N1 0001 \le N \le 1 \ 000
  • 1M1 0001 \le M \le 1 \ 000
  • 1Lmin(N,M)1 \le L \le \min(N, M)
  • 0KNM0 \le K \le N\cdot M
# Points Constraints
1 0 Examples
2 30 K1K \leq 1
3 50 N3N \leq 3
4 20 No additional constraints

Example 1

stdin

4 3 2 4

stdout

NO

Explanation

It is not possible to make a painting satisfying the constraints.

Example 2

stdin

4 4 3 2

stdout

YES
RBRR
BGGB
GRBG
RBBG

Explanation

One possible painting, represented in the output, is the following:

It contains 44 squares of size 33, that are the following:

Only the first 22 of them contain the same amount of red, green and blue cells. Hence, the painting satisfies Carlo's request.

Log in or sign up to be able to send submissions!