A nature reserve is fenced off along a closed line that never crosses itself. The fence is described by its corners, listed in the order somebody walking along it would pass them - either clockwise or counter-clockwise, we are not told which. After the last corner the fence goes straight back to the first one.
A ranger stands at the point and wants to know whether they are inside the reserve. Standing on the fence, corners included, counts as being inside.
Input
The first line contains a single integer - the number of testcases.
- The first line of each testcase contains a single integer - the number of corners.
- Each of the next lines contains two integers and - one corner of the fence, in walking order.
- The last line of the testcase contains two integers and - where the ranger stands.
Output
For every testcase print YES if the ranger is inside the reserve, and NO otherwise.
Example
2 8 0 0 5 0 5 1 1 1 1 3 5 3 5 4 0 4 2 2 4 0 0 5 0 5 5 0 5 2 2
NO YES
The first fence is a wide letter C opening to the right, and the point sits in the notch between its two arms - outside the reserve, even though it looks surrounded. The second fence is a plain square with the point comfortably in the middle.
Constraints
the fence never crosses itself, and no two neighbouring corners are the same point
This problem was adapted, with permission, from Pripadnost tačke prostom poligonu, authored by Društvo matematičara Srbije and Fondacija Petlja.