CSU-ACM Online Judge

2061: Z‘s Coffee

      Time Limit: 1 Sec     Memory Limit: 128 Mb     Submitted: 138     Solved: 48     SpecialJudge


Z is crazy about coffee. One day he bought three cups of coffee. The first cup has a capacity of Aml, the second has Bml and the third has Cml. At the beginning, only the first cup is full of coffee, that is, Z only has Aml coffee and the other cups is empty. Because the cup has no scale, one operation of pouring coffee only stop until either one cup is full or empty. Z can only choose two cups to do the pouring operation. For some reasons, Z wants to get exactly Dml of coffee, and also he is so lazy that want the number of operations as least as possible. So he ask you for help.


The first line is the case number T.

Each case has one line with four integers ABCD as mentioned above.

1 ≤ A, B, C ≤ 1000

1 ≤ D ≤ max(A, B, C)

1 ≤ T ≤ 100


If he can get the exactly milliliter of coffee as he want, then print the least number of operation in a line.

And print the initial capacity of the three cups and then print the result after each operation line by line.

The print order should be the first cup, the second cup and the third cup.

If there are more than one operation schema, any of them will be accepted.

If he cannot get the exactly milliliter of coffee as he want , print "-1" without quotation.

Sample Input

12 8 5 10

Sample Output

12 0 0
7 0 5
0 7 5
5 7 0
5 2 5
10 2 0