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"}

-----Subtasks-----
Subtask 1: (25 points)
- 1 ≤ T ≤  12000 
- For each test case there will be at most three different colors

Subtask 2: (75 points)
- Original constraints

-----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).

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'import math\nimport sys\n\ndef _int():\n return int(sys.stdin.readline())\n\ndef _ints():\n return list(map(int, sys.stdin.readline().split()))\n\ndef _intarr():\n return list(map(int, sys.stdin.readline().split()))\n\ndef _str():\n return sys.stdin.readline()\n\ndef _strarr():\n return sys.stdin.readline().split()\n\ndef adj(a, b, c):\n if b != opp[a] and b != opp[c] and a != opp[c]:\n  return True\n return False\n\nt = _int()\n\nopp = [1, 0, 3, 2, 5, 4]\n\nfor _ in range(t):\n c = _strarr()\n cd = dict()\n for i in range(len(opp)):\n  ind = cd.get(c[i], [])\n  ind.append(i)\n  cd[c[i]] = ind\n \n #print(cd)\n\n found = False\n for k in list(cd.keys()):\n  ind = cd.get(k, [])\n  if len(ind) == 3:\n   if adj(ind[0], ind[1], ind[2]):\n     found = True\n  elif len(ind) == 4:\n   if adj(ind[0], ind[1], ind[2]):\n    found = True\n   elif adj(ind[0], ind[1], ind[3]):\n    found = True\n   elif adj(ind[0], ind[2], ind[3]):\n    found = True\n   elif adj(ind[1], ind[2], ind[3]):\n    found = True\n  elif len(ind) >= 5:\n   found = True\n  if found:\n   break\n print("YES" if found else "NO")\n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 14881