eolymp
bolt
Try our new interface for solving problems
Problems

Geometry Darts

Geometry Darts

\includegraphics{https://static.e-olymp.com/content/ef/ef8aae37032322841d3fadbcab914d1e17f075c9.jpg} Bob and Hannah like to play darts. They are not very good at it, however, so finishing a round of \textbf{501} Darts will take an eternity. They therefore decide to throw away the dartboard completely and put geometric shapes on the wall instead, awarding points according to the number of shapes the dart penetrates. To reduce the complexity of scoring, they only use circles, triangles and rectangles. A game consists of each person throwing \textbf{3} darts each, and your job is to find the winner of the game, given the shapes and the throws. \InputFile The input will start with a line giving the total number of shapes \textbf{S }(\textbf{0} < \textbf{S} ≤ \textbf{1000}). Then follow \textbf{S} lines describing the shapes, in either of the following formats: \begin{enumerate} \item \textbf{C x y r}, where (\textbf{x}; \textbf{y}) is the center of the circle, and \textbf{r} is the radius. \item \textbf{R x1 y1 x2 y2}, where (\textbf{x1}; \textbf{y1}) and (\textbf{x2}; \textbf{y2}) are two corners of the rectangle with \textbf{x1} < \textbf{x2} and \textbf{y1} < \textbf{y2}. \item \textbf{T x1 y1 x2 y2 x3 y3}, where (\textbf{xi}; \textbf{yi}) are the three corners of the triangle. \end{enumerate} Then follows a line with \textbf{N} (\textbf{0} < \textbf{N} ≤ \textbf{1000}), the number of games Bob and Hannah play. Each game is described with six lines giving the \textbf{x} and \textbf{y} coordinates of the \textbf{6} throws, the first three by Bob and the last three by Hannah. \begin{itemize} \item All rectangles have sides parallell to the \textbf{x} and \textbf{y}axis. \item For triangle specifications, the three points will never be collinear. \item All coordinates are given with double precision, with up to \textbf{6} decimals after the decimal points. \item All shapes are bounded by the rectangle defined by the two points (\textbf{-1000}; -\textbf{1000}) and (\textbf{1000}; \textbf{1000}). \item All throws are guaranteed to be at least \textbf{10^\{-6\}} away from any shape boundary. \end{itemize} \OutputFile Output the name of the winner on a separate line for each game, or Tied if there is a tie.
Time limit 1 second
Memory limit 64 MiB
Input example #1
3
C 0.0 0.0 5.0
R -1.0 -1.0 7.0 7.0
T 0.0 0.0 -3.0 0.0 0.0 -8.0
1
0.0 4.1
0.0 6.2
0.0 8.1
-0.5 -0.5
-0.5 -2.0
-0.5 -5.1
Output example #1
Hannah