atcoder#CODEFESTIVAL2017QUALAD. Four Coloring

Four Coloring

Score : 700700 points

Problem Statement

We have a grid with HH rows and WW columns of squares. We will represent the square at the ii-th row from the top and jj-th column from the left as (i, j)(i,\ j). Also, we will define the distance between the squares (i1, j1)(i_1,\ j_1) and (i2, j2)(i_2,\ j_2) as i1i2+j1j2|i_1 - i_2| + |j_1 - j_2|.

Snuke is painting each square in red, yellow, green or blue. Here, for a given positive integer dd, he wants to satisfy the following condition:

  • No two squares with distance exactly dd have the same color.

Find a way to paint the squares satisfying the condition. It can be shown that a solution always exists.

Constraints

  • 2H,W5002 \leq H, W \leq 500
  • 1dH+W21 \leq d \leq H + W - 2

Input

Input is given from Standard Input in the following format:

HH WW dd

Output

Print a way to paint the squares satisfying the condition, in the following format. If the square (i, j)(i,\ j) is painted in red, yellow, green or blue, cijc_{ij} should be R, Y, G or B, respectively.

c11c_{11}c12c_{12}......c1Wc_{1W}

::

cH1c_{H1}cH2c_{H2}......cHWc_{HW}

2 2 1
RY
GR

There are four pairs of squares with distance exactly 11. As shown below, no two such squares have the same color.

  • (1, 1)(1,\ 1), (1, 2)(1,\ 2) : R, Y
  • (1, 2)(1,\ 2), (2, 2)(2,\ 2) : Y, R
  • (2, 2)(2,\ 2), (2, 1)(2,\ 1) : R, G
  • (2, 1)(2,\ 1), (1, 1)(1,\ 1) : G, R
2 3 2
RYB
RGB

There are six pairs of squares with distance exactly 22. As shown below, no two such squares have the same color.

  • (1, 1)(1,\ 1) , (1, 3)(1,\ 3) : R , B
  • (1, 3)(1,\ 3) , (2, 2)(2,\ 2) : B , G
  • (2, 2)(2,\ 2) , (1, 1)(1,\ 1) : G , R
  • (2, 1)(2,\ 1) , (2, 3)(2,\ 3) : R , B
  • (2, 3)(2,\ 3) , (1, 2)(1,\ 2) : B , Y
  • (1, 2)(1,\ 2) , (2, 1)(2,\ 1) : Y , R