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.
For each test case, if you can restore the Rubik's cube in 3 steps, output "YES", else output "NO". (both without quote)