The Curious Prince

No attempts yetTime limit1sMemory limit128 MB

Problem

A tiny planet has the shape of a convex polyhedron. The Little Prince wants to travel from the spot where his rocket landed to the rose. He always moves only along the surface of the planet; he can neither pass through its interior nor leap through the air.

The planet is a convex polyhedron and every face is a convex polygon. Given the landing point and the rose, both lying on the surface, find the length of the shortest path between them that stays on the surface.

Input

The first line contains the number of test cases dd (1d1501 \le d \le 150).

Each test case is given as follows. The first line contains the number of faces of the planet nn (4n154 \le n \le 15). Each of the next nn lines describes one face. A face description starts with the number of its vertices kk (3kn13 \le k \le n-1), followed by the coordinates x y zx\ y\ z of its kk vertices listed in order around the boundary of the face. No two faces lie in the same plane.

The last line of each test case contains the coordinates of the landing point xa ya zax_a\ y_a\ z_a and of the rose xb yb zbx_b\ y_b\ z_b. Both points lie on the surface of the planet. All coordinates are integers between 1000-1000 and 10001000.

Output

For each test case, print on its own line the shortest surface distance between the landing point and the rose, rounded to exactly two decimal places.