Under construction

Still being built. Things may change

Hobbiton Farms

Interview

Time limit1sMemory limit128 MB

Summary
For each test case, decide whether a circle and an axis-aligned rectangle share at least one point.
Level

Easy3 of 10

Topics
Geometry, Implementation, Math
Solved
No attempts yet

Problem

The Home Owners Association (HOA) of Hobbiton — the village in the Shire where Bilbo lives — wants to draw a new map that shows the exact boundaries of every house's land parcel. This is tricky, because a parcel may be shaped either as a circle or as an axis-aligned rectangle.

Before drawing the map, the HOA wants to confirm that its records are consistent, and in particular that no two parcels overlap. It already knows how to test two circles against each other, and two rectangles against each other. It needs your help with the remaining case: one parcel is a rectangle and the other is a circle.

For each pair, decide whether the circle and the rectangle overlap, i.e. whether they share at least one common point.

Input

The first line contains the number of test cases TT (with T<100T < 100). Each of the next TT lines contains one test case: seven positive real numbers (of type double)

r, xc, yc, xl, yl, xu, yu.r,\ x_c,\ y_c,\ x_l,\ y_l,\ x_u,\ y_u.

  • rr, xcx_c, ycy_c — the radius rr and the center (xc,yc)(x_c, y_c) of the circle;
  • xlx_l, yly_l — the lower-left corner of the axis-aligned rectangle;
  • xux_u, yuy_u — the upper-right corner of the rectangle.

All seven numbers are positive.

Output

For each test case, print exactly one line. If the circle and the rectangle overlap, print

The given circle and rectangle overlap.

Otherwise print

The given circle and rectangle do not overlap.

Examples1

  1. Example 1

    Input
    4
    10.0 50.0 50.0 55.0 55.0 56.0 56.0
    20.0 50.0 50.0 55.0 55.0 56.0 56.0
    10.0 50.0 50.0 30.0 30.0 31.0 31.0
    10.5 50.5 50.5 40.0 40.0 41.0 41.0
    
    Expected output
    The given circle and rectangle overlap.
    The given circle and rectangle overlap.
    The given circle and rectangle do not overlap.
    The given circle and rectangle do not overlap.