$$N$$ children are playing a game of Rotate and Speak. In this game all the children are given a number plate which contains distinct values and they need to form a circle in clockwise order.
There are $$Q$$ turns in this game. In each turn two numbers $$a$$ and $$b$$ are announced. The rules of the game are as follows :
- If the number $$a$$ is equal to 1 then it means that all the children shift $$b$$ steps in anti clockwise direction.
- If the number $$a$$ is equal to 2 then it means that all the children shift $$b$$ steps in clockwise direction.
- If the number $$a$$ is equal to 3 then it means that the child who is standing at position $$b$$ in the clockwise order speaks the number on his number plate. Note that the positions are from $$0$$ to $$N-1$$ not $$1$$ to $$N$$
Input format:
First line contains an intege $$T$$ that denotes the number of test cases
First line in every test case contains an integer $$N$$ denoting the count of children playing the game.
Second line in every test case contains $$N$$ space separated integers , here the $$i^{th}$$ integer is the number on the number plate of the student $$i$$
Third line in every test case contains an integer $$Q$$,number of turns in the game.
Following $$Q$$ lines ,each contain two integers describing one of the $$3$$ types of moves in a turn.
Output format:
For each moves of type 3, you have to print the number that will be spoken in that turn of the game.
Constraints:
\(1 \le T \le 20\)
\(1 \le N,Q \le 10^{5} \)
\(1 \le a \le 3\)
\(0 \le b \le N-1\)
Note- Since input files are large, use fast input/output methods.