Colored CubeRemeber Rubik's Cube? Dr. Brownian was fascinated with it. He kept trying to imagine a translucent version. Unfortunately, no one could ever visualize what he was describing. He could not build one either. He did manage to build a simplified version. A real simple version - a cube with six tinted sides. And of course this leads to a problem for you! Problem: A Cube has 6 sides, each of which may be 1 of 5 different tinted panes. Each tinted pane filters light differently. If the pane is tinted red, green, or blue it is translucent. The only completely opaque tint, through which light cannot pass, is black. Clear panes are not tinted at all (but described as a clear tint to make the wording of the rest of this problem easier).Your task is to determine which color light is transmitted through the cube, given the tints of the panes on each side of the cube and the side through which you are looking. For our purposes, we only need to determine the transmitted color of light when the cube is oriented orthogonally to our viewing direction, hence only 2 tinted panes are effectively visible for any one of the desired viewpoints (the light you see passes through the pane you are looking in and the pane exactly opposite it in the cube). A black pane blocks light; a clear side does not tint the color of the light; red, green, and blue filter the red, green and blue tints respectively of the transmitted light. The table below summarizes the resulting colors, given two sides of arbitrary color:
Note that the order of the tints is irrelevant (red and blue are just as purple as blue and red). Input: A number of cubes will be indicated by the first line of input. Following that will be 7 lines of data describing each cube. The first line will be which pane (side) to look through. The next 6 lines will indicate the colors of each of the sides (1 through 6 respectively). If the sides of the cube were unfolded and the sides were subsequently numbered, the cube would look like the following:
This is the order in which the input will be given for the sides. The 6 lines of data stating which tint is on each pane contain a single digit representing each tint. Output: You will output (in text) the color as viewed though the slected panes. Sample Input: 3 number of cubes 1 side to look through 7 side 1 3 side 2 9 side 3 8 side 4 3 side 5 0 side 6 2 side to look through 3 side 1 8 side 2 7 side 3 9 side 4 8 side 5 7 side 6 4 side to look through 7 side 1 3 side 2 8 side 3 9 side 4 3 side 5 0 side 6 Note: The items in italics are here to help you understand the data. Your real input will only have numbers. Sample Output: RED DARK BLUE AQUA |