Little Y falls in love with robots recently. It's really a complex job to run a robot. So we will start with a relatively simple work.
A basic problem is to handle the robot hand. The robot hand consists of N + 1 joints which are labeled from 0 to N. There's a hard rod between the kth joint and the k+1th joint. To make the problem simple, we will consider the joints and rods as N + 1 points and N segments (their thickness would be ignored in our problem) in xyz 3D (three-dimensional) coordinates. The 0th joint is always at (0, 0, 0).
As the first step to handle a robot hand, Little Y needs to process some ROs (rotation operation).
There are 3 parameters in RO: an integer idx in [0, N-1], a real number Alpha in [0, 2π] and a 3D non-zero vector P. With such RO, the hand from joint idx to joint N will be rotated. This part will be rotated around an axis for alpha radian. The axis is paralleled to P and passes joint idx. In our rotation, you may assume that movement will not be blocked.
Now we’ll explain the direction of rotations. You may easy find out your front (F), back (B), left (L), right (R), up (U) and down (D) direction. Then you may assume x-axis goes from F to B, y-axis goes from L to R and z-axis goes from D to U.
For example, define 3D vectors A(1, 0, 0), B(0, 1, 0) and C(0, 0, 1) and a angle Alpha = π⁄2. Rotate A with Alpha and axis(C) will results in B. Rotate C with Alpha and axis(B) will results in A. Rotate B with Alpha and axis(A) will results in C.
Consider joint idx = (1, 1, 1), rotate (2, 1, 1) with angle = π⁄2 and axis (0, 0, 1) will results in (1, 2, 1).
However, there are so many joints and ROs for Little Y that he cannot handle them! So he asks you for help. Try to help him!
1 2 0 0 0 1 0 0 1 0 1.5707963267948966192313216916398 0 0 1 2 1 2 3 0 0 0 1 0 0 2 0 0 1 0 1.5707963267948966192313216916398 0 0 1 1 1 1.5707963267948966192313216916398 1 0 0 2 2 0 0
0.0000 1.0000 0.0000 0.0000 1.0000 1.0000