- Time limit: 1.00 s
- Memory limit: 512 MB
There are two line segments: the first goes through the points and , and the second goes through the points and .
Your task is to determine if the line segments intersect, i.e., they have at least one common point.
Input
The first input line has an integer : the number of tests.
After this, there are lines that describe the tests. Each line has eight integers , , , , , , and .
Output
For each test, print "YES" if the line segments intersect and "NO" otherwise.
Constraints
Example
Input:
5 1 1 5 3 1 2 4 3 1 1 5 3 1 1 4 3 1 1 5 3 2 3 4 1 1 1 5 3 2 4 4 1 1 1 5 3 3 2 7 4
Output:
NO YES YES YES YES