Time Limit: 6000/3000 MS (Java/Others)

Memory Limit: 262144/262144 K (Java/Others)

These days Lotus is interested in Brownian movement, so she wants to write a simulation program to meet her research desire.

The purpose of this procedure is to simulate the irregular movement of some points on a two-dimensional plane, and to support the following operations:

I x y: indicates that a new point $(x, y)$ is found in the plane. The index of the new point is the number of points already existing in the plane plus 1.

M l r x y: indicates that the points whose index belong to $[l, r]$ moved $x$ units right and $y$ units up.

R l r x y a: indicates that the points whose index belong to $[l, r]$ were rotated counterclockwise by the angle $a$. the rotation center is $(x, y)$. $a$ is radian, and $a$ contains at most one decimal place.

F l r x y d: indicates that the points whose index belong to $[l, r]$ scaled d times, the scaling center is $(x, y)$.It's Guaranteed that $d\in[0,1]$, and $d$ contains at most one decimal place.

Q id: Ask for the coordinates of the point whose index is $id$, output a line of two real numbers, separated by a space, Suppose the answers are x,y,you should use printf("%.0lf %.0lf\n",floor(x),floor(y)); to output them.

The purpose of this procedure is to simulate the irregular movement of some points on a two-dimensional plane, and to support the following operations:

I x y: indicates that a new point $(x, y)$ is found in the plane. The index of the new point is the number of points already existing in the plane plus 1.

M l r x y: indicates that the points whose index belong to $[l, r]$ moved $x$ units right and $y$ units up.

R l r x y a: indicates that the points whose index belong to $[l, r]$ were rotated counterclockwise by the angle $a$. the rotation center is $(x, y)$. $a$ is radian, and $a$ contains at most one decimal place.

F l r x y d: indicates that the points whose index belong to $[l, r]$ scaled d times, the scaling center is $(x, y)$.It's Guaranteed that $d\in[0,1]$, and $d$ contains at most one decimal place.

Q id: Ask for the coordinates of the point whose index is $id$, output a line of two real numbers, separated by a space, Suppose the answers are x,y,you should use printf("%.0lf %.0lf\n",floor(x),floor(y)); to output them.

The input includes multiple test cases. The first line contains a single integer $T$, the number of test cases.

The first line of each test case contains a single integer $q\in[1,100000]$, the number of operations.

The next $q$ line, each line contains the description of an operation.

For all number in the input file, it's guaranteed that they are in $[-1000,1000]$

It's guaranteed there are at most 2 test cases with $q > 10000$。

The first line of each test case contains a single integer $q\in[1,100000]$, the number of operations.

The next $q$ line, each line contains the description of an operation.

For all number in the input file, it's guaranteed that they are in $[-1000,1000]$

It's guaranteed there are at most 2 test cases with $q > 10000$。

For each operation Q, print a line of two real number presenting the answer.

It's guaranteed that the absolute value of the answer won't be greater than $10^7$.

It's guaranteed that the absolute value of the answer won't be greater than $10^7$.

提交代码