시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 75 11 9 13.433%

문제

희원이는 생일 선물로 3차원 공간에 있는 삼각형 두 개를 받았다.

각 삼각형은 매우 얇은 선분으로 이루어져 있고, 각 선분은 매우 세게 눌러도 휘어지지 않는다.

사실 희원이는 삼각형 하나를 원한다. 따라서, 삼각형을 움직여서 멀리 떨어뜨려 놓으려고 한다. 삼각형을 회전시키는 것도 허용된다. 이렇게 두 삼각형을 서로 떨어뜨려 놓을 수 있는지, 아니면 꼬인 상태인지 알아내는 프로그램을 작성하시오.

입력

첫째 줄에 테스트 케이스의 개수 1 ≤ T ≤ 1000가 주어진다. 각 테스트 케이스는 두 줄로 이루어져 있다. 첫째 줄은 첫 번째 삼각형의 꼭지점을 나타내는 9개의 정수 x1, y1, z1, x2, y2, z2, x3, y3, z3 ∈ [-1000,1000] 로 이루어져 있다. 둘째 줄은 두 번째 삼각형의 꼭지점을 나타내는 9개의 정수 x'1, y'1, z'1, x'2, y'2, z'2. x'3, y'3, z'3 ∈ [-1000,1000] 로 이루어져 있다. 두 삼각형의 세 꼭지점은 일직선 위에 있지 않다. 또, 두 삼각형을 교차하게 만드는 선분의 쌍은 존재하지 않으며, 두 삼각형을 동시에 포함하는 평면도 없다. 

출력

각 테스트 케이스에 대해서, 두 삼각형이 꼬여있는 상태라면 YES를 출력하고, 두 삼각형이 서로 멀리 떨어질 수 있는 상태이면 NO를 출력한다.

예제 입력 1

2
0 0 0 10 0 0 0 10 0
1 1 10 1 1 -10 10 10 0
0 0 0 10 0 0 0 10 0
11 0 0 0 11 0 11 11 1

예제 출력 1

YES
NO

힌트

W3sicHJvYmxlbV9pZCI6IjkyMTIiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWQyYjhcdWI3N2NcdWM3NzRcdWM1NzVcdWFlMDAiLCJkZXNjcmlwdGlvbiI6IjxwPlx1ZDc2Y1x1YzZkMFx1Yzc3NFx1YjI5NCBcdWMwZGRcdWM3N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