![]() |
||||||||||
|
||||||||||
cube cube cubeTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 327680/327680 K (Java/Others)Total Submission(s): 11561 Accepted Submission(s): 264 Problem Description Rubick has a strange cube. Can you restore Rubik's cube in 3 steps (including 3)? Rubik's cube is shown in the following picture: ![]() The plane expansion of the Rubik's cube is shown in the following figure, each number represents the color corresponding to each cube. ![]() The following picture explains how to rotate this strange cube. If you still feel confused, you can refer to http://www.bilibili.com/video/av8452301/?from=search&seid=11750270100959783079 . ![]() Input The first line contains an integer $T$ ($T \leq 10$), the number of test cases. Each test case consists of 72 integers which correspond to the colors of each location of the Rubik's Cube. Each number represents one color, it's guaranteed that there are exactly 8 colors and each color appears 9 times. Output For each test case, if you can restore the Rubik's cube in 3 steps, output "YES", else output "NO". (both without quote) Sample Input
Sample Output
Source | ||||||||||
|