Triangle of Triangles
시간 제한2초메모리 제한2048 MB
삼각형 하나와 두 목표 각도 조합이 주어질 때, 한 꼭짓점에서 그은 선분으로 삼각형을 잘라 두 조각이 각각 목표 조합이 되는지 판정한다.
문제
Audrey has a favorite triangle. Specifically, the angles of the triangle are degrees, degrees, and degrees.
Ruan Mei only likes two types of triangles. Specifically, she only likes a triangle if the degrees of the three angles are either degrees, degrees, and degrees; or degrees, degrees, and degrees. The order of the angles does not matter.
Audrey and Ruan Mei only like multiples of , so it is guaranteed that the degree measures of all of the angles in their favorite triangles are divisible by .
Audrey wants to draw a line segment starting at one vertex of her favorite triangle and ending at the opposite side of that vertex such that, if she cuts the triangle along that line segment, she divides the triangle into two smaller triangles, both of which Ruan Mei likes. Is this possible?
입력
The first line contains a single integer, (). test cases follow.
The description for each test case spans three lines.
The first line contains three integers, , , and ().
The second line contains three integers, , , and ().
The third line contains three integers, , , and ().
It is guaranteed at least one of , , or . It is furthermore guaranteed that all of these values are divisible by .
출력
Output lines. On the th line, output the answer for the th test case.
Output YES if it is possible for Audrey to cut her favorite triangle exactly once to form two triangles, both of which Ruan Mei likes. Otherwise, output NO.