codeforces#P1971C. Clock and Strings
Clock and Strings
Description
There is a clock labeled with the numbers through in clockwise order, as shown below.

In this example, , and the strings intersect.
Alice and Bob have four distinct integers , , , not more than . Alice ties a red string connecting and , and Bob ties a blue string connecting and . Do the strings intersect? (The strings are straight line segments.)
The first line contains a single integer () — the number of test cases.
The only line of each test case contains four distinct integers , , , ().
For each test case, output "YES" (without quotes) if the strings intersect, and "NO" (without quotes) otherwise.
You can output "YES" and "NO" in any case (for example, strings "yEs", "yes", and "Yes" will be recognized as a positive response).
Input
The first line contains a single integer () — the number of test cases.
The only line of each test case contains four distinct integers , , , ().
Output
For each test case, output "YES" (without quotes) if the strings intersect, and "NO" (without quotes) otherwise.
You can output "YES" and "NO" in any case (for example, strings "yEs", "yes", and "Yes" will be recognized as a positive response).
Note
The first test case is pictured in the statement.
In the second test case, the strings do not intersect, as shown below.
