11107 - Problem F. A.T. Field   

Description

The year is 2015, 15 years after the first disastrous contact with the mysterious beings known as Angels resulted in the global cataclysm referred to as the Second Impact, which wiped out half of the human race. To defend humanity against future Angel attacks, the United Nations established the NERV organization in Tokyo-3 to develop giant bio-mechanical mecha known as Evangelions. Now, the Angels have finally returned, and the untested Evangelions can only be piloted by specially selected 14-year-olds. Shinji Ikari, estranged son of the director of NERV, Commander Gendo Ikari, arrives in Tokyo-3 and is dragooned into piloting Evangelion Unit-01 to fight the Angel, Sachiel, which is attacking the city.

As the operator of Evangelion (EVA) Unit-01, you always need to generate Absolute Terror Field (A.T. Field) to protect yourself from the enemy’s attack. The appearance of A.T. Field is a red triangle in 3D space, and it can rebound anything touching the triangle.

In the training, the mentor will tell you how to adjust the A.T. Field. Please figure out where is the final position of the A.T. field. 

Input

The first line contains an integer T (T 1000), which indicates the number of test cases.

For each case, the first three lines denote the triangle, and every line contains 3 floating numbers indicating the position of one of the triangle’s points. (xi, yi, zi) The fourth line contains 3 floating numbers denoting the angles of the rotation by the ordering of x-axis, y-axis, and z-axis. (θx, θy, θz, θ [π, π])

There is one blank line before every testcase. 

Output

For each case, output three lines and every line contains 3 floating numbers denoting the position after the rotation. (xi, yi, zi

Sample Input  Download

Sample Output  Download

Tags




Discuss