시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
3 초 128 MB 9 6 6 66.667%

문제

There are two circles with radius 1 in 3D space. Please check two circles are connected as chained rings.

 

입력

The input is formatted as follows.

pe

First line contains three real numbers(−3 ≤ cxi, cyi, czi ≤ 3). It shows a circle's center position. Second line contains six real numbers (−1 ≤ vxi,j ,vyi,j, vzi,j ≤1). A unit vector (vx1,1, vy1,1, vz1,1) is directed to the circumference of the circle from center of the circle. The other unit vector (vx1,2, vy1,2, vz1,2) is also directed to the circumference of the circle from center of the circle. These two vectors are orthogonalized. Third and fourth lines show the other circle information in the same way of first and second lines. There are no cases that two circles touch.

출력

If two circles are connected as chained rings, you should print "YES". The other case, you should print "NO". (quotes for clarity)

 

예제 입력

0.0 0.0 0.0
1.0 0.0 0.0 0.0 1.0 0.0
1.0 0.0 0.5
1.0 0.0 0.0 0.0 0.0 1.0

예제 출력

YES

예제 입력 2

0.0 0.0 0.0
1.0 0.0 0.0 0.0 1.0 0.0
0.0 3.0 0.0
0.0 1.0 0.0 -1.0 0.0 0.0

예제 출력 2

NO

예제 입력 3

1.2 2.3 -0.5
1.0 0.0 0.0 0.0 1.0 0.0
1.1 2.3 -0.4
1.0 0.0 0.0 0.0 0.70710678 0.70710678

예제 출력 3

YES

예제 입력 4

1.2 2.3 -0.5
1.0 0.0 0.0 0.0 1.0 0.0
1.1 2.7 -0.1
1.0 0.0 0.0 0.0 0.70710678 0.70710678

예제 출력 4

NO

힌트