#P10245. Swimming Pool

Swimming Pool

Background

Please note that in quadrilateral ABCDABCD, the four points must be in order as A,B,C,DA,B,C,D. Cases like ABAB being a diagonal are not allowed.

Problem Description

Little J wants to build a quadrilateral swimming pool ABCDABCD. He wants one pair of opposite sides to be parallel (so it is convenient to hold some family competitions), and the other pair of opposite sides to be not parallel (otherwise it would look too ordinary). In other words, he needs this swimming pool to be a trapezoid.

Given four positive integers p,q,r,sp,q,r,s, determine whether he can build a swimming pool that satisfies the requirement, such that AB=pAB=p, BC=qBC=q, CD=rCD=r, and DA=sDA=s.

Input Format

This problem contains multiple test cases. The first line of input contains a positive integer TT indicating the number of test cases.

The next TT lines each contain four positive integers p,q,r,sp,q,r,s separated by spaces.

Output Format

For each test case, output one line. If a trapezoid can be formed, output yes; otherwise output no.

3
20 2 4 8
3 5 3 5
1 2 4 3

no
no
yes

Hint

[Sample Explanation]

In the first test case, it is obviously impossible to form a quadrilateral.

In the second test case, it can only form a parallelogram.

In the third test case, it can indeed form a trapezoid.

[Constraints]

This problem has 66 test points. Note that the points are not evenly distributed.

Test Point ID Special Property Score
11 A trapezoid can be formed if and only if a quadrilateral can be formed. 1919
22 p<r<sp<r<s and q<sq<s 1717
33 p,q,r,s2p,q,r,s\le 2 77
44 p<rp<r and q<sq<s 1212
55 The input is guaranteed to be able to form a quadrilateral. 1818
66 No special property. 2727

For all data, it is guaranteed that 1T1041\le T\le 10^4, 1p,q,r,s5×1081\le p,q,r,s\le 5\times 10^8, and all inputs are positive integers.

Translated by ChatGPT 5