The Good, the Bad and the Ugly are going to have their famous three-way duel. For each pair of gunmen X and Y, with X ≠ Y, we know the independent probability that if X shoots at Y, X will hit and kill Y. Otherwise, Y will remain unhurt.

Initially, the Good will shoot at the Bad, the Bad will shoot at the Ugly, and the Ugly will shoot at the Good. This will happen simultaneously, and as many times as needed, until at least one of the gunmen dies. Afterwards, if two of them are still alive, they will shoot at each other simultaneously and repeatedly until at least one of them dies.

Given the six killing probabilities, what are the chances for each of the gunmen to survive?

Input

Input begins with the number of cases t. Follow t matrices with 3 rows and 3 columns of probabilities each, which correspond in order to the Good, the Bad and the Ugly. For instance, the second number of the first row is the probability that if the Good shoots at the Bad, the Bad will immediately die. The main diagonal is all zeroes. The rest are real numbers strictly larger than 0 and smaller than or equal to 1.

Output

For each case, print the surviving probability of the Good, the Bad and the Ugly in this order, with four digits after the decimal point. The input cases have no precision issues.

Public test cases

**Input**

3 0 0.5 0.5 0.5 0 0.5 0.5 0.5 0 0 1 1 0.01 0 0.01 0.01 0.01 0 0 0.8 0.6 0.3 0 0.1 0.2 0.5 0

**Output**

0.2381 0.2381 0.2381 0.9802 0.0000 0.0099 0.5619 0.0098 0.2818

Information

- Author
- Salvador Roura
- Language
- English
- Official solutions
- C++
- User solutions
- C++