Rings
Time limit3sMemory limit128 MB
Decide whether two unit circles in 3D space are linked like chain rings from their centers and orientation vectors.
Problem
Two circles of radius 1 lie in 3D space. Circle is fixed by its centre and two orthogonal unit vectors and , and its points are
Decide whether the two circles are linked like the rings of a chain. They are linked when no motion pulls them apart without passing one circle through the other.
Input
The first line contains three real numbers , , , the centre of the first circle, with .
The second line contains six real numbers , , , , , , each between and . The first three are the unit vector pointing from the centre to the circumference, and the last three are the unit vector defined the same way. The two vectors are orthogonal.
The third and fourth lines describe the second circle in the same format.
No input has the two circles touching.
Output
Print "YES" if the two circles are linked like the rings of a chain, and "NO" otherwise. Do not print the quotes.