A Rubik's Cube is a three-dimensional puzzle. A standard Rubik's Cube is made of 3×3×3 smaller cubes. The puzzle is solved when the nine small cubes on each face all show the same color.
Each face of the cube can be turned 90 degrees in either direction. After finishing one turn you may turn another face, and by alternating turns of different faces the colors get scrambled.
In this problem the cube starts fully solved, with the following face colors:
You are given a sequence of turns. After performing all of them, determine the colors of the top (Up) face.
The first line contains the number of test cases (at most 100). Each test case is given as follows:
For each test case, print the colors of the top (Up) face over three lines. The first line contains the row of cells adjacent to the back face, and the second and third lines follow in order toward the front face. Within each line, print the cells from the one adjacent to the left face to the one adjacent to the right face. Use these letters: w for white, y for yellow, r for red, o for orange, g for green, b for blue.