Geometry Darts

No attempts yetTime limit1sMemory limit256 MB

Problem

Bob and Hannah like darts but are not good at it, so finishing a round of 501 takes them forever. They put the dartboard away, taped geometric shapes to the wall instead, and now score a dart by how many shapes it goes through. To keep the scoring simple they use only circles, triangles and rectangles.

In one game each player throws three darts. A dart scores the number of shapes that contain the point it landed on, and a player's score is the sum over their three darts. Given the shapes and the throws, report the winner of each game.

Input

The first line has the number of shapes SS. Each of the next SS lines describes one shape in one of these three formats:

  • C x y r: a circle with center (x,y)(x, y) and radius rr
  • R x1 y1 x2 y2: a rectangle whose opposite corners are (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2), with x1<x2x_1 < x_2 and y1<y2y_1 < y_2
  • T x1 y1 x2 y2 x3 y3: a triangle with corners (x1,y1)(x_1, y_1), (x2,y2)(x_2, y_2) and (x3,y3)(x_3, y_3)

The next line has the number of games NN. Each game takes six lines, and each line has the xx and yy coordinate of one landing point. The first three lines are Bob's throws and the last three are Hannah's.

  • 0<S10000 < S \le 1000
  • 0<N10000 < N \le 1000
  • Every rectangle has sides parallel to the xx and yy axes.
  • The three corners of a triangle are never collinear.
  • All coordinates are real numbers given with up to 6 digits after the decimal point.
  • Every shape fits inside the rectangle with opposite corners (1000,1000)(-1000, -1000) and (1000,1000)(1000, 1000).
  • Every landing point is at least 10610^{-6} away from the boundary of every shape.

Output

Print the winner of each game on its own line. Print Bob if Bob scores higher, Hannah if Hannah scores higher, and Tied if the two scores are equal.