Cyclic Quadrilateral Codechef Solution

Cyclic Quadrilateral Solution Problem Code: CYCLICQD

You are given the sizes of angles of a simple quadrilateral (in degrees) AA, BB, CC and DD, in some order along its perimeter. Determine whether the quadrilateral is cyclic.

Note: A quadrilateral is cyclic if and only if the sum of opposite angles is 180∘180∘.

Input

  • The first line of the input contains a single integer TT denoting the number of test cases. The description of TT test cases follows.
  • The first and only line of each test case contains four space-separated integers AA, BB, CC and DD.

Output

Print a single line containing the string "YES" if the given quadrilateral is cyclic or "NO" if it is not (without quotes).

You may print each character of the string in uppercase or lowercase (for example, the strings “yEs”, “yes”, “Yes” and “YES” will all be treated as identical).

Constraints

  • 1≤T≤1041≤T≤104
  • 1≤A,B,C,D≤3571≤A,B,C,D≤357
  • A+B+C+D=360A+B+C+D=360

Example Input

3
10 20 30 300
10 20 170 160
179 1 179 1

Example Output

NO
YES
NO

Explanation

Example case 1: The sum of two opposite angles A+C=10∘+30∘≠180∘A+C=10∘+30∘≠180∘.

Example case 2: The sum of two opposite angles A+C=10∘+170∘=180∘A+C=10∘+170∘=180∘ and B+D=20∘+160∘=180∘B+D=20∘+160∘=180∘.

Example case 3: The sum of two opposite angles B+D=1∘+1∘≠180∘B+D=1∘+1∘≠180∘.

Weekly Contest 247

Biweekly Contest 55

June Long Challenge 2021 Solutions

March Long Challenge 2021 Solutions

April Long Challenge 2021 Solutions

Codechef Long Challenge Solutions

February Long Challenge 2021

January Long Challenge 2021

November Challenge 2020 SOLUTION CodeChef

October Lunchtime 2020 CodeChef SOLUTIONS

Related :

Related :

Leave a Comment

2 − one =