P13583 [CodeChef] chcube
普及
题目描述

One day, Chef found a cube which has each of its sides painted in some color out of black, blue, red, green, yellow and orange.
Now he asks you to check if he can choose three sides such that they are pairwise adjacent and painted in the same color.

Input

The first line of the input contains an integer T denoting the number of test cases.
A single line of each test case contains six words denoting the colors of painted sides in the order: front, back, left, right, top and bottom, respectively.

Output
For each test case, output a single line containing the word "YES" or "NO" (without quotes) corresponding to the answer of the problem.

Constraints

1 ≤ T ≤ 50000
Each color will be from the list {"black", "blue", "red", "green", "yellow", "orange"}

Example
Input:
2
blue yellow green orange black green
green yellow green orange black green

Output:
NO
YES

Explanation

Example case 1.
There are no three sides with the same color.

Example case 2.
In this test case, the front, bottom and left sides are green (see picture).

输入格式

见题面

输出格式

见题面

样例输入
2 blue yellow green orange black green green yellow green orange black green
样例输出
NO YES