A triangle in plane geometry is made of three sides and the three angles between them. Write the side lengths as $a$, $b$, $c$, and write the angle opposite each side as $\alpha$, $\beta$, $\gamma$, so $\alpha$ lies opposite $a$, $\beta$ opposite $b$, and $\gamma$ opposite $c$.
Geometry books list many formulas for triangles.
$$ \begin{aligned} \alpha + \beta + \gamma &= \pi \ \frac{a}{\sin \alpha} = \frac{b}{\sin \beta} &= \frac{c}{\sin \gamma} \ a &= b \cos \gamma + c \cos \beta \ a^2 &= b^2 + c^2 - 2bc \cos \alpha \ \frac{a - b}{a + b} &= \frac{\tan \frac{\alpha - \beta}{2}}{\tan \frac{\alpha + \beta}{2}} \end{aligned} $$
The six values $a$, $\alpha$, $b$, $\beta$, $c$, $\gamma$ fully determine a triangle. Once enough of them are known, the formulas above give the rest.
Write a program that computes the missing values from a given subset. Some subsets say too little to fix a single triangle, and some describe no triangle at all. A valid triangle has all three sides greater than 0, and all three angles greater than 0 and less than $\pi$. In those cases print Invalid input.. Print the same phrase when more than the minimal set is given but the values contradict each other, for example when all three angles are given and their sum exceeds $\pi$. When more than the minimal set is given, a computed value $x$ and a given value $y$ agree when $|x - y| \le 10^{-6} \max(1, |x|, |y|)$.
Other subsets admit more than one triangle, yet only finitely many. Then print More than one solution.
In every other case compute the missing values and print all six.
The first line holds the number of parameter sets. Each following line holds six numbers separated by a single space: the values of $a$, $\alpha$, $b$, $\beta$, $c$, and $\gamma$, in that order. Angles are measured in radians. A value of -1 means the parameter is not given and has to be computed. Every floating-point number carries at least eight significant digits.
Print one line per parameter set. When the values fix exactly one valid triangle, print $a$, $\alpha$, $b$, $\beta$, $c$, $\gamma$ in that order, separated by single spaces. Round each value at the seventh decimal place and always print six digits after the decimal point, padding with zeros.
When more than one triangle fits and their number is finite, print More than one solution. When no single triangle is determined or no valid triangle exists, print Invalid input.
No value in the test data sits close enough to a sixth-decimal boundary for the rounding to be in doubt.