Brick Game

Time Limit: 1 Second    Memory Limit: 32768 KB

There's a game called Brick Game. In this game, the player controls a number of bricks on a 9*9 grid. In every step, the player has 3 choices. One is rotating the 9*9 grid clockwise; The second is rotating the 9*9 grid counter-clockwise; The third is dropping a pattern sized 1*3 bricks(you should treat them separately) down from the middle of the upest line. Each brick has a kind of color. After each step, the bricks that hang in the air will drop down until they touch other bricks or the bottom, then three or more adjacent bricks will be removed if they have the same color(here we call two bricks that share a common border "adjacent"). This process will go on until no brick can be removed. In this problem, you are asked to simulate the whole process. The 9*9 grid is empty at the beginning. A list of what the player has done will be given. You should output the final situation after all the operation by the player.

Input

The input consists of several test cases. Each test case contains several lines. There's a operation in each line, which can be 'CW', 'CCW', 'DROP' as the description above. If the operation is 'DROP', it will be followed by a string contains exactly upper letters. In the string, each upper letter represents a kind of color. There're five kinds of color, R(red), G(green), B(blue), Y(yellow), W(white). The end for each test case is always a line contains 'END'.

Output

The output of each test case contains a string of "FAIL" or a final situation with 9*9 grid. "FAIL" should be output if the drop operation fails during the process, i.e. there're bricks in the three middle of the upest line when the player want to drop a new pattern. Note that output the whole 9*9 grid and use a '.' represents the empty grid. Output a blank line after each test case.

Sample Input

DROP RGB
CW
CCW
END

DROP RGB
DROP RGB
DROP RGB
END

Sample Output

.........
.........
.........
.........
.........
.........
.........
.........
......RGB

.........
.........
.........
.........
.........
.........
.........
.........
.........
Submit

Source: ZOJ 3rd Anniversary Contest