J :: Jeometric Polygon

Time Limit: 10 Seconds    Memory Limit: 65536 KB

There is a polygon with vertices A1A2...An (numbered in the clockwise order). On each side AiAi+1 an isosceles triangle AiMiAi+1 is built on the outer side of the polygon, with an angle AiMiAi+1=ai (assuming An+1 = A1).


The set of angles ai satisfies a condition that the sum of angles in any of its nonempty subsets is not aliquot to 360 degrees.


You are given n coordinates of vertices Mi and angles ai (measured in degrees). Write a program which restores coordinates of the polygon vertices.


Input

The first line of the input is an integer T 16, indicating the number of test cases. For each test case, the first line is an integer n ≤ 50, the next n lines contain pairs of real numbers which are coordinates of points Mi. The next n lines of the input consist of degree values of angles ai.


Output

The output file should contain n lines of pairs of coordinates of the points with value rounded to two digits after the decimal point.


Print a blank line between two test cases.


Sample Input

1
3
0 2
3 3
2 0
90
90
90


Sample Output

1.00 1.00
1.00 3.00
3.00 1.00
Submit