This page is still under construction.

Parts of this page are still being built. What you see may change.

Watch, Man!

Time limit1sMemory limit256 MB

Summary
Decide whether guards cover each art piece at its required level when segment and arc walls block sight lines.
Level

Hard8 of 10

Topics
Graph, Geometry
Solved
No attempts yet

Problem

Lou Va is the curator of a museum known around the world. Hundreds of pieces are on display, and a few of them are valuable enough to need extra security. Lou has picked a set of guard positions around the museum and wants to staff them so the valuable pieces stay watched.

After reviewing the pieces and the guards' resumes, Lou gave every piece and every guard a level. A piece of level nn must be in view of at least nn guards. A guard of level mm has enough experience to watch up to mm pieces. Lou wants a placement in which every piece is watched by the number of guards its level asks for.

There is one more complication. This is a modern-art museum and its layout is not conventional. Every wall of a room is either a straight line segment or an arc of a circle. There can also be one or more interior sets of walls that block the guards' views. Each set of interior walls forms a simple closed loop, and when there is more than one such set, no two of them intersect and none is nested inside another.

A guard watches a piece when the straight segment joining the two meets no wall.

Sometimes the current placement is not enough to watch every piece at its level. Lou needs to know when that happens so he can move the guards or the pieces. For each test case, decide whether the current placement is enough.

Input

The first line of each test case has three integers nn, aa and gg: the number of wall sets, the number of art pieces and the number of guards, where 1≤n1 \le n and 0≤a,g≤1000 \le a, g \le 100.

Descriptions of the nn wall sets follow, and the first set is the set of outer walls. Each description starts with an integer mm, the number of walls in the set. Then come mm integer coordinate pairs xix_i yiy_i, each followed by either s or c. An s means the point (xi,yi)(x_i, y_i) is joined to the next point by a straight wall. A c means it is joined by a circular arc, and two integers dxdx and dydy follow, giving the direction of the tangent to that circle at (xi,yi)(x_i, y_i). The arc is the one that leaves (xi,yi)(x_i, y_i) heading in the direction (dx,dy)(dx, dy) and ends at the next point. The last point of a set is joined back to the first, which closes the loop.

The total number of walls for all the rooms in one test case is at most 125. After the wall descriptions come aa integer coordinates giving the positions of the art pieces, each followed by a positive level, then gg integer coordinates giving the positions of the guards, each followed by a positive level. No wall corner lies on a segment joining an art piece and a guard, and no such segment is tangent to a curved wall. All coordinates are in the range −150000-150000 to 150000150000. A line holding three zeros ends the input.

Output

For each test case print one line holding Case k: Yes or Case k: No, where kk is the test case number counting from 1. Print Yes when the guards in their current positions can watch every art piece at its level, and No otherwise.

Examples3

  1. Example 1

    Input
    1 3 2
    5
    0 0 s
    0 20 c 0 1
    20 20 s
    40 20 s
    40 0 s
    2 18 1
    15 18 2
    38 2 2
    2 2 3
    38 18 2
    1 3 2
    5
    0 0 s
    0 20 c 0 1
    20 20 s
    40 20 s
    40 0 s
    2 18 1
    18 24 2
    38 2 2
    2 2 3
    38 18 2
    2 3 2
    5
    0 0 s
    0 20 c 0 1
    20 20 s
    40 20 s
    40 0 s
    2
    23 19 c 1 0
    15 11 s
    2 18 1
    15 18 2
    38 2 2
    2 2 3
    38 18 2
    0 0 0
    
    Expected output
    Case 1: Yes
    Case 2: No
    Case 3: No
    
  2. Example 2

    Input
    1 0 0
    4
    0 0 s
    0 10 s
    10 10 s
    10 0 s
    1 1 0
    4
    0 0 s
    0 10 s
    10 10 s
    10 0 s
    5 5 1
    0 0 0
    
    Expected output
    Case 1: Yes
    Case 2: No
    
  3. Example 3

    Input
    1 2 1
    4
    0 0 s
    0 10 s
    10 10 s
    10 0 s
    3 3 1
    7 7 1
    5 5 1
    1 2 1
    4
    0 0 s
    0 10 s
    10 10 s
    10 0 s
    3 3 1
    7 7 1
    5 5 2
    0 0 0
    
    Expected output
    Case 1: No
    Case 2: Yes