Canyon Crossing
Time limit1sMemory limit128 MB
Decide whether a path from the left edge to the right edge of a rectangle avoids up to 1000 circular craters.
- Level
Medium6 of 10
- Topics
- Union-find, Geometry
- Solved
- No attempts yet
Problem
Friendship One is a new rover that the Astronautical Center for Machinery ordered for exploring Triton, a moon of Neptune. It launches on March 18th, and the flight software has to be ready by then. Your boss handed you the part the whole mission rests on.
To collect the samples it needs, the rover has to cross a canyon. Friendship One drives over rough rock without trouble, but this canyon is covered with circular craters. If the rover drives into a crater it tips over and the mission fails. Craters can overlap each other and merge into wide regions that nothing can pass. Decide whether the canyon can be crossed.
The canyon is a rectangle of height and width . The rover starts at some point of the left edge and has to reach some point of the right edge . Its route is a continuous curve that stays inside the canyon, so holds the whole way, and the curve never meets a crater. Friendship One is tiny next to the craters, so treat it as a point with no area.
A crater is a closed disk, so its rim belongs to it. Two craters that meet at a single point are connected, and a crater whose rim reaches or exactly touches that edge.
The picture shows the first case of the first example.

Input
The first line contains the number of test cases .
Each test case starts with a line of three integers , , and . and () are the height and the width of the canyon, and () is the number of craters. Each of the next lines describes one crater with three real numbers , , and separated by spaces, where is the center and is the radius. Every crater satisfies , , and , and part of a crater may lie outside the canyon.
Output
Print one line per test case. Writing for the case number, counting from 1, print Case x: Clear To Go if Friendship One can cross the canyon, and Case x: Find Another Path if the craters block every route.