Hedgehog Alina is experimenting with organizing jars of apples in her warehouse. She has devised a machine that can completely reverse the order of jars within a specified segment. Alina now wants to simulate how this machine operates.
The first line contains the integer , representing the number of jars Alina has. (N \le 10^5)
The second line lists integers separated by spaces, indicating the quality of apples in each corresponding jar.
The third line contains the integer , which is the number of machine queries (M \le 5 \cdot 10^5).
Each of the following lines describes one of two types of queries:
, - Reverse the order of jars in the segment from index to (inclusive). (0 \le L < R \le N-1)
- Retrieve the quality of apples in the jar at position . (0 \le X \le N-1)
For each query of the second type, output the quality of apples at the specified position on a separate line.
Example 1