An RGB Masterpiece

Time limit: 0.5s Memory limit: 64MB Input: Output:

Task

Ovidiu is a fan of pixel art and is particularly interested in RGB grids.
An RGB grid consists of a rectangular grid where every cell is coloured either red, green, or blue.
He also figured out that, in order to create a masterpiece, the following rules have to be followed:

  • The grid has NN rows and MM columns.
  • There are exactly RR red cells, GG green cells and BB blue cells.
  • There are no cells that share a side and have the same colour.

However, Ovidiu isn't able to create one himself, and he asked for your help.
Can you tell if a masterpiece exists and, if so, produce one?

Input data

The input file consists of a single line containing integers NN, MM, RR, GG, BB.

Output data

If a masterpiece exists, the output file must contain N+1N+1 lines, the first line must consist of the string YES and the following NN lines must contain a string of length MM, consisting of characters R, G and B, representing a masterpiece.

If there are more than one possible masterpiecee, you may print any of them.

If no masterpiece exists, the output file must consist of a single line containing only the string NO.

Constraints and clarifications

  • 1N,M1051 \le N,M \le 10^5.
  • 1NM1051 \le N \cdot M \le 10^5.
  • 0R,G,B1050 \le R,G,B \le 10^5.
  • R+G+B=MNR + G + B = M \cdot N.
# Score Constraints
1 0 Examples.
2 17 NM10N \cdot M \le 10.
3 21 B=0B = 0.
4 23 N=1N = 1.
5 39 No additional limitations.

Example 1

stdin

2 3 2 2 2

stdout

YES
RBG
BGR

Explanation

In the first sample case, one possible masterpiece is depicted below.
Note that there are 22 red cells, 22 green cells and 22 blue cells. Also, no two adjacent cells have the same colors.

Example 2

stdin

3 3 1 6 2

stdout

NO

Explanation

In the second sample case, there are no masterpieces satisfying the requirements.

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