Don't Cross the Circles!
Time limit1sMemory limit256 MB
Decide whether two points can be joined by a curve that crosses none of up to 100 given circle circumferences.
Problem
One or more circles lie on a plane. Any two circles differ in center position, in radius, or in both. A circle may overlap another circle, but no three or more circles share an area or a point. A circle may contain another circle completely, and two circles may meet at two distinct points, but the circumferences of two circles never touch at a single point.
Given two points and , decide whether a path connects them without crossing the circumference of any circle. The path may be any curve as long as it stays off every circumference. Each layout of circles comes with one or more point pairs.
Input
The input has several datasets, each in the following format.
...
...
The first line of a dataset has two integers and separated by a space. is the number of circles and satisfies . is the number of point pairs and satisfies . Each of the next lines has three integers separated by a space. is the center of the -th circle and is its radius. Each of the next lines has four integers separated by a space. They give the coordinates of two points and , which form the -th point pair. The coordinates and the radii satisfy , , , , , , . and are two different points, and neither lies on the circumference of any circle.
The end of the input is a line with two zeros separated by a space.
Output
For each dataset, print the results on one line, separated by single spaces. The -th result is YES if a path connects and , and NO otherwise.