eolymp
bolt
Try our new interface for solving problems
Problems

Ardenia

Ardenia

Welcome to Ardenia. Ardenia is a mythical land, filled with adventure and danger, dwarves and dragons, mages and rouges. And puzzles. Lots of puzzles. Actually, the love for puzzles is the most important life ingredient of the inhabitants, and the only part they have in common.

This month, the people of Ardenia wonder what is the distance between two line segments in three dimensional space. The distance between segments is defined as the minimum among distances between two points of di erent segments. Actually, this problem had originally some motivation, but as nobody from Ardenia cares about motivations, neither should you.

Input

The first line contains the number of test cases t105.

The first line of each test case contains six integers x1, y1, z1, x2, y2, z2 ∈ [-20; 20]. Points (x1, y1, z1) and (x2, y2, z2) are the different endpoints of the first segment. The second line contains six integers in the same format, describing the second segment.

Output

Print two co-prime integers l and m > 0, such that l / m is the squared distance between the given two segments.

Time limit 1 second
Memory limit 128 MiB
Input example #1
2
0 0 0 1 1 1
1 1 1 2 2 2
1 0 0 0 1 0
1 1 0 2 2 0
Output example #1
0 1
1 2
Source 2010 ACM Central Europe (CERC), November 19 - 21, Problem A