TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

Given a grid of R x C. A cell (r1,c1) is known to be red, while another cell (r2,c2) is known to be blue.

Fill the cells in the grid with either blue of red such that:

1) The cells of same color is connected (connectivity in the sense of adjacent in the 4 directions up, down, left, right)

2) The shape formed by red cells and the shape formed by blue cells are of same shape. (That is, the set of blue cells can be obtained from red cells using only shifts, rotations and reflection).


Warn: 本題有 specialjudge

Input Format

The first line contains an integer T, indicating the number of testcase.

Each testcases consists of six numbers: R, C, r1, c1, r2, c2.

1 <= T <= 1000

1 <= R,C <= 100

(r1,c1) and (r2,c2) are valid and does not represent a same cell. Rows and Columns are numbered starting from 1.

Output Format

For each testcase, output a plausible solution. In case the task is impossible to be done, output "IMPOSSIBLE".

Print a blank line between each testcases.

Sample Input 1

2

1 6
1 5
1 4

3 8
1 5
1 2

Sample Output 1

IMPOSSIBLE

BBBBRRRR
BBBBRRRR
BBBBRRRR

Hints

Problem Source

Migrated from old NTUJ.

IPSC

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 3000 65536 1000