
An enthusiastic puzzle solver is training to solve the Rubik's Cube quickly. (For those unfamiliar with the puzzle, a Rubik's Cube is a cube where each face is divided into three rows and three columns (nine "squares"). Any of the six faces of the cube may be rotated either clockwise or counterclockwise, which also rotates the three nearest squares on each adjoining face onto a new face, respectively. When solved, each face of the cube contains squares of only one color.)
They record rotation sequences to study their effect on the cube's state. Write a simulator program that determines the state of the cube after a given sequence of rotations.
The faces are indicated by the color of the central square: White, Orange, Red, Blue, Green, and Yellow.
The first line contains the number of test cases (an integer from to ). Each case consists of three lines giving the initial state of the cube and one line giving the rotations.
Each of the three lines of the initial state consists of letters with a single space between each pair. Each letter is W, O, R, B, G, or Y. The faces are listed from left to right: White, Orange, Red, Blue, Green, Yellow.
The fourth line gives rotations: each is a letter (W, O, R, B, G, or Y) indicating which face to rotate 90^\circ clockwise. Between and rotations will be specified.
Output the cube state after the rotations. Format: three lines of letters separated by spaces. Print faces in the same order: White, Orange, Red, Blue, Green, Yellow. After each test case, print a line with = characters.
Example 1