Persistent Array#2955

Persistent Array

1 second
128 megabytes
Very easy

An array is given (specifically, its initial version). You need to answer two types of queries:

Input

The number of elements in the array (1 \le n \le 10^5), followed by the elements of the array. Next is the number of queries (1 \le m \le 10^5), followed by queries. The format of the queries is given in the sample input. If there are already versions of the array, the new one receives the number k+1. Both the initial and newly created elements of the array are integers from to 10^9. The elements in the array are numbered from to .

Output

For each query of type get, output the corresponding element of the required array version.

Examples

Example 1

Loading
Loading