Under construction

Still being built. Things may change

T-X vs T-850

Interview

Time limit2sMemory limit1024 MB

Summary
For each query, decide whether the segment between two points avoids the boundary of a circle, so the shooter can see the target.
Level

Medium4 of 10

Topics
Geometry, Math
Solved
No attempts yet

Problem

Time limit: 2000 ms. Memory limit: 1024 MB.

I'm back!

T-850

The T-850 terminator has returned to face the Skynet computer network again. This time Skynet sends its newest invention against it, the terminator T-X, built to destroy T-850 and start Judgment Day.

The fight takes place in open terrain with only one building. The building is a circle of radius rr centered at (xc,yc)(x_c, y_c). T-850 is at (x1,y1)(x_1, y_1) and T-X is at (x2,y2)(x_2, y_2). T-850 wants to fire at T-X, but it can do so only if it can see T-X.

T-850 sees T-X only if the segment connecting them does not intersect the wall of the building. Help the programmers from the future who write T-850's software handle even this case and determine whether T-850 can fire at T-X at this moment.

Input

The first line contains the number of queries tt (1≤t≤51 \le t \le 5). Each query consists of three lines.

The first line gives the building's coordinates and radius xcx_c, ycy_c, rr. The second line gives the coordinates of T-850, x1x_1, y1y_1. The third line gives the coordinates of T-X, x2x_2, y2y_2.

All numbers in the input are integers with absolute value at most 100. It is guaranteed that the distance from the line through (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2) to (xc,yc)(x_c, y_c) differs from rr by more than 10−510^{-5}. It is also guaranteed that neither T-X nor T-850 lies on the boundary of the building.

Output

For each query, print YES if T-850 can fire at T-X, and NO otherwise.

Examples1

  1. Example 1

    Input
    3
    0 0 1
    0 0
    2 0
    0 0 1
    -2 0
    2 0
    0 0 1
    2 0
    2 1
    
    Expected output
    NO
    NO
    YES