The Navi-Computer is Down!

Time limit1sMemory limit128 MB

Problem

An Imperial cruiser and its squadron of TIE fighters are hot on the tail of the Millennium Falcon. The Falcon has taken minor damage to its aft and port thrusters, but worse, the Navi-Computer is down — without it the ship cannot jump to hyperspace and escape.

  • Luke: Han, why not just jump to hyperspace? We can't hold out against that Imperial cruiser much longer!
  • Han: Traveling through hyperspace ain't like dusting crops, boy! Without precise calculations we could fly right through a star, or bounce too close to a supernova, and that'd end your trip real quick.
  • Leia: He's right, Luke. We need proper calculations entered, or...
  • C-3PO: We're doomed!
  • Leia: There must be something we can do! The Rebel Alliance is depending on us.
  • C-3PO: Your Highness, R2-D2 says he has a star map of the galaxy, with 3-space coordinates for every location!
  • Han: Great, but with the Navi-Computer down I need more than coordinates — I need the distance between our current location and our destination, and I'm no math tech.
  • Leia: It doesn't take a math tech. Anyone who's been to school knows the distance between two points in 3-space is the square root of the sum of the squared differences of the x-, y-, and z-coordinates. The result is in galactic units.
  • Luke: I remember that! It looks like this:

$d = \sqrt{(\Delta x)^2 + (\Delta y)^2 + (\Delta z)^2} = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2}$

  • Han: Get me the name and coordinates of the current star system, the name and coordinates of the destination system, and the distance between them, so I can enter it all and jump to hyperspace. And I need that distance accurate to two digits after the decimal point.

Help Leia compute the distance between two star systems, accurate to two digits after the decimal point, and save the Millennium Falcon and its crew!

Input

The first line contains an integer $n$ ($0 < n < 200$), the number of entries to process. Each of the $n$ entries is given on four lines:

  • the name of the current star system, on its own line;
  • the $x$, $y$, and $z$ coordinates of that system, separated by single spaces, on one line;
  • the name of the destination star system (always different from the current one), on its own line;
  • the $x$, $y$, and $z$ coordinates of the destination system, on one line.

A star system name may contain alphanumeric characters, whitespace, and punctuation, and is at most 30 characters long. The coordinates are real numbers given with two digits after the decimal point, with $-100000.00 < x, y, z < 100000.00$; use double-precision reals to avoid rounding errors. The distance between the two systems is always at least one galactic unit.

Output

For each entry, output one line containing: the name of the current star system, a space, the word to, a space, the name of the destination star system, a colon, a space, and finally the distance between the two systems printed with two digits after the decimal point.