#P17391. [PacNW 2025] Triangle of Triangles

[PacNW 2025] Triangle of Triangles

Problem Description

Audrey's favorite triangle has angles a1a_1, b1b_1, and c1c_1 degrees. Ruan Mei likes exactly two kinds of triangles: one with angles a2a_2, b2b_2, and c2c_2, and one with angles a3a_3, b3b_3, and c3c_3. The order of the angles does not matter.

Audrey wants to draw a segment from one vertex of her triangle to the opposite side, cutting the triangle into two smaller triangles. Determine whether both resulting triangles can be kinds that Ruan Mei likes.

Input Format

The first line contains an integer TT (1T1041\le T\le10^4), the number of test cases.

Each test case consists of three lines. Line jj contains three integers aj,bj,cja_j,b_j,c_j satisfying 5ajbjcj1705\le a_j\le b_j\le c_j\le170 and aj+bj+cj=180a_j+b_j+c_j=180. All values are divisible by 55. The two triangle types Ruan Mei likes are distinct.

Output Format

For each test case, output YES if one cut can produce two triangles Ruan Mei likes. Otherwise, output NO.

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