The Three-Way Splitting Weapon

Given three targets, find the launch angle whose projectile splits into three rays 25 degrees apart that strike all targets with the least speed.

Medium7GeometryMathNo attempts yetTime limit3sMemory limit256 MB

Problem

A popular mobile game launches birds at targets, and it has several weapons of different colors. The red one flies along an ordinary projectile path. The yellow one also flies along a projectile path, but if the screen is touched again in mid-flight the effect of gravity almost disappears and the weapon keeps its current direction in a straight line. The blue one splits into three parts when the screen is touched again: the middle part keeps the original direction and the other two spread slightly to the left and to the right. The new weapon in this problem is a hybrid of those two.

Figure 1Figure 2Figure 3
The screen is touched when the yellow weapon reaches the white circle.The screen is touched when the blue weapon reaches the white circle.Paths of the new weapon.

The new weapon starts along a projectile path. At the moment the screen is touched it splits into three parts, and after the split gravity no longer acts on them, so each part travels in a straight line. The middle part keeps the velocity direction it had at the moment of the split. The other two travel 25 degrees to the left and 25 degrees to the right of that direction. The three parts hit the targets A, B and C, one each.

The weapon is always thrown from the origin (0,0)(0, 0). You are free to pick the throwing angle θ\theta, the throwing speed vv, and the moment of the split. The gravitational acceleration is g=9.8g = 9.8, lengths are measured in coordinate units and time in seconds. No force other than gravity acts on the weapon, so there is no wind. Before the split the weapon does not hit a target even if it passes through one.

Given the coordinates of the three targets, find the throwing angle θ\theta in degrees that lets the three parts hit all three targets.

Input

The first line contains the number of test cases TT. (T10000T \le 10000)

Each of the next TT lines contains one test case: six real numbers x1x_1, y1y_1, x2x_2, y2y_2, x3x_3, y3y_3 separated by spaces. The three targets are at (x1,y1)(x_1, y_1), (x2,y2)(x_2, y_2) and (x3,y3)(x_3, y_3), and 500.0x1,x2,x310000.0500.0 \le x_1, x_2, x_3 \le 10000.0. The distance between any two targets is at least 5. Which part hits which target is not fixed.

Output

For each test case print one line in the form Case i: theta. Here ii is the test case number starting from 1, and θ\theta is the throwing angle in degrees printed with six digits after the decimal point.

A throw counts as a valid solution only if it satisfies all of the following.

  1. The speed vv is at least 50 and at most 5000.
  2. The angle θ\theta is at least 10 degrees and at most 80 degrees.
  3. Each part moves forward from the split point along its own direction, so all three targets lie on rays that start at the split point.

At least one valid solution always exists. If there is more than one valid solution, print the θ\theta of the one that needs the smallest speed vv.