Target Practice

In target practice you sometimes shoot at cardboard figures. In this problem a target is described by a simple polygon which is the outline of the target. For each target you will find out where a number of shots fired at the target struck. Some may have hit the target and some may have missed. Your job is to determine for each shot whether it hit or whether it missed. If the shot missed, you should determine how far away from the target the shot was. If the shot hit, you should determine how large a margin there was, i.e., how far away from the contour of the target the shot was.

Each test case starts with a number $3 \le n \le 1000$ which is the number of vertices of the target polygon (in clockwise or counter clockwise order). Then follow $n$ lines giving the coordinates $x$ and $y$ of each vertex. Then follows a line with an integer $s \le 100$ which is the number of shots fired at that target. Finally, there are $s$ lines giving the coordinates $x$ and $y$ of each shot. Coordinates are integers between $-10\, 000$ and $10\, 000$ inclusive.

The final test case is followed by a line with $n=0$. There are at most $5$ test cases.

For each test case, output “`Case
$c$`” where
$c$ is the number of the
test case. Then follows a line for every shot fired at the
target. For each shot, if it missed, print “`Miss! $d$`”
and if it hit, print “`Hit! $d$`” where $d$ is the distance mentioned above.
If a shot hits the edge of the target, print “`Winged!`”. The distance should be given with an
absolute error of at most $10^{-3}$.

Sample Input 1 | Sample Output 1 |
---|---|

4 0 0 0 10 10 10 10 0 2 3 1 11 11 3 0 0 10 10 10 0 1 5 0 0 |
Case 1 Hit! 1.000000000 Miss! 1.414213562 Case 2 Winged! |