TWOCIR - Entangled Circles

no tags

The description of this problem is extremely simple. You are given 2 non-intersecting circles in 3-dimensional world. Each of the circles is defined by 3 non - collinear points lying on the circle. All you have to return is whether the circles are entangled or not (just like two links of a chain). Two circles are entangled if they cannot be separated from each other without breaking any of the circles.

Input

The first line contains a single integer, T, the number of test cases. Each of the T test cases are defined by 2 lines. The first line of each test case contains 9 integers representing the 3 points as (x1, y1, z1), (x2, y2, z2), (x3, y3, z3) which define the first circle. Similarly, the second line for each test case contains 9 integers representing the 3 points which define the second circle.

Outpu:

For every query output "YES" without quotes if the circles are entangled and "NO" otherwise (quotes for clarity).

Constraints

1 ≤ T ≤ 100

-10000 ≤ Each Coordinate in the Input ≤ 10000

Sample

```Input
1
0 1 0 1 0 0 0 -1 0
0 0 0 1 0 -1 1 0 1

Output
YES
```

Problem Setter: Lalit Kundu

 Added by: darkshadows Date: 2014-01-26 Time limit: 1s Source limit: 50000B Memory limit: 1536MB Cluster: Cube (Intel G860) Languages: All except: ASM64