There is a row with N blocks. Blocks are numbered from left to right in 1-based indexing. The i-th block's value is ai.
First you have to sort these blocks by their value in increasing order. So the order of blocks may be changed after sorting.
Then you need to execute Q operations. There are two kinds of operations:
It's guaranteed that the first type of operations appears at most N - 1 times(i.e there must be at least one block all the time).
Note: be careful of the efficiency of your strategy. And the difference between rounding up and rounding down is to carry or to chop the remainder. For instance:
The first line contains one integer N (1 ≤ N ≤ 105) – the number of blocks.
The second line contains N integers a1, a2, ..., aN (0 ≤ ai ≤ 1018) – the value of each block.
The third line contains one integer Q (1 ≤ Q ≤ 105) – the number of operations you need to execute.
Then Q lines follow. The i+3-th line contains one integer typei (1 ≤ typei ≤ 2) – the type of operations you need to execute. If typei = 2 then one integer k (1 ≤ k ≤ N', where N' is the number of blocks then) follows.
It's guaranteed that:
For every 2nd type operations, output the k-th block's value then.