Triangle of Triangles

시간 제한2초메모리 제한2048 MB

요약
삼각형 하나와 두 목표 각도 조합이 주어질 때, 한 꼭짓점에서 그은 선분으로 삼각형을 잘라 두 조각이 각각 목표 조합이 되는지 판정한다.
난이도

보통10점 중 6점

유형
기하, 수학, 완전 탐색, 구현
정답자
아직 제출이 없습니다

문제

Audrey has a favorite triangle. Specifically, the angles of the triangle are a_1a\_1 degrees, b_1b\_1 degrees, and c_1c\_1 degrees.

Ruan Mei only likes two types of triangles. Specifically, she only likes a triangle if the degrees of the three angles are either a_2a\_2 degrees, b_2b\_2 degrees, and c_2c\_2 degrees; or a_3a\_3 degrees, b_3b\_3 degrees, and c_3c\_3 degrees. The order of the angles does not matter.

Audrey and Ruan Mei only like multiples of 55, so it is guaranteed that the degree measures of all of the angles in their favorite triangles are divisible by 55.

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, TT (1≤T≤1041 \le T \le 10^4). TT test cases follow.

The description for each test case spans three lines.

The first line contains three integers, a_1a\_1, b_1b\_1, and c_1c\_1 (5≤a_1≤b_1≤c_1≤170,a_1+b_1+c_1=1805 \le a\_1 \le b\_1 \le c\_1 \le 170, a\_1 + b\_1 + c\_1 = 180).

The second line contains three integers, a_2a\_2, b_2b\_2, and c_2c\_2 (5≤a_2≤b_2≤c_2≤170,a_2+b_2+c_2=1805 \le a\_2 \le b\_2 \le c\_2 \le 170, a\_2 + b\_2 + c\_2 = 180).

The third line contains three integers, a_3a\_3, b_3b\_3, and c_3c\_3 (5≤a_3≤b_3≤c_3≤170,a_3+b_3+c_3=1805 \le a\_3 \le b\_3 \le c\_3 \le 170, a\_3 + b\_3 + c\_3 = 180).

It is guaranteed at least one of a_2≠a_3a\_2 \neq a\_3, b_2≠b_3b\_2 \neq b\_3, or c_2≠c_3c\_2 \neq c\_3. It is furthermore guaranteed that all of these values are divisible by 55.

출력

Output TT lines. On the iith line, output the answer for the iith 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.

예제1

  1. 예제 1

    입력
    3
    30 60 90
    15 30 135
    45 45 90
    30 60 90
    15 30 135
    40 50 90
    45 45 90
    45 45 90
    5 10 165
    
    예상 출력
    YES
    NO
    YES