#C5671. Does the Rectangle Contain the Origin?

    ID: 49346 Type: Default 1000ms 256MiB

Does the Rectangle Contain the Origin?

Does the Rectangle Contain the Origin?

Given a rectangle defined by two opposite corners ( (x_1, y_1) ) and ( (x_2, y_2) ), determine whether the origin ( (0,0) ) lies inside the rectangle or exactly on its boundary. A point ( (0,0) ) is considered to be inside or on the boundary of the rectangle if it satisfies the conditions

[ \min(x_1, x_2) \le 0 \le \max(x_1, x_2) \quad \text{and} \quad \min(y_1, y_2) \le 0 \le \max(y_1, y_2). ]

You are to read the input from standard input and write your answer to standard output.

inputFormat

The input begins with an integer ( T ) representing the number of test cases (rectangles). Each of the next ( T ) lines contains four space-separated integers: ( x_1 ), ( y_1 ), ( x_2 ), and ( y_2 ), which denote the coordinates of two opposite corners of a rectangle.

outputFormat

For each rectangle, output a single line containing either "YES" if the origin is inside or on the boundary of the rectangle, or "NO" otherwise.## sample

3
-1 -1 1 1
2 2 4 4
0 -3 3 3
YES

NO YES

</p>