Triangles and Quadrangle#3091

Triangles and Quadrangle

1 second
64 megabytes
Very hard

Little Yuan is two years old and she is learning about triangles and quadrangles. She is such a smart girl that she soon realizes two triangles can form a quadrangle without overlapping each other. She picks up a lot of triangles and uses them to form some quadrangles. Unfortunately, she is not very good at this kind of jigsaw game and sometimes makes mistakes.

As her brother, you want to check whether she has made a mistake when forming two triangles into a quadrangle. You decide to write a program to determine this.

A quadrangle in this problem is defined as a simple polygon with four vertices. You may also assume that all triangles and quadrangles have positive area.

Two figures are considered the same if and only if they can overlap completely by shifting, rotating, or flipping. You can also shift, rotate, or flip either triangle when forming the quadrangle.

Input

There are multiple test cases. The first line of input contains a single integer denoting the number of test cases (T \le 500).

For each test case, there are lines in total.

The first 3 \times 2 lines describe the two triangles. Each line contains two integers, representing the coordinates of a point.

The next lines describe the quadrangle in clockwise or counterclockwise order.

All coordinates are less than in absolute value.

Output

For each test case, output "Yes" if the given triangles can form a quadrangle without overlapping, or "No" otherwise.

Examples

Example 1

Loading
Loading