Package for this problem was not updated by the problem writer or Codeforces administration after we’ve upgraded the judging servers. To adjust the time limit constraint, solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then value 800 ms will be displayed and used to determine the verdict.

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

E. Copying Data

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputWe often have to copy large volumes of information. Such operation can take up many computer resources. Therefore, in this problem you are advised to come up with a way to copy some part of a number array into another one, quickly.

More formally, you've got two arrays of integers *a* _{1}, *a* _{2}, ..., *a* _{ n} and *b* _{1}, *b* _{2}, ..., *b* _{ n} of length *n*. Also, you've got *m* queries of two types:

- Copy the subsegment of array
*a*of length*k*, starting from position*x*, into array*b*, starting from position*y*, that is, execute*b*_{ y + q}=*a*_{ x + q}for all integer*q*(0 ≤*q*<*k*). The given operation is correct — both subsegments do not touch unexistent elements. - Determine the value in position
*x*of array*b*, that is, find value*b*_{ x}.

For each query of the second type print the result — the value of the corresponding element of array *b*.

Input

The first line contains two space-separated integers *n* and *m* (1 ≤ *n*, *m* ≤ 10^{5}) — the number of elements in the arrays and the number of queries, correspondingly. The second line contains an array of integers *a* _{1}, *a* _{2}, ..., *a* _{ n} (|*a* _{ i}| ≤ 10^{9}). The third line contains an array of integers *b* _{1}, *b* _{2}, ..., *b* _{ n} (|*b* _{ i}| ≤ 10^{9}).

Next *m* lines contain the descriptions of the queries. The *i*-th line first contains integer *t* _{ i} — the type of the *i*-th query (1 ≤ *t* _{ i} ≤ 2). If *t* _{ i} = 1, then the *i*-th query means the copying operation. If *t* _{ i} = 2, then the *i*-th query means taking the value in array *b*. If *t* _{ i} = 1, then the query type is followed by three integers *x* _{ i}, *y* _{ i}, *k* _{ i} (1 ≤ *x* _{ i}, *y* _{ i}, *k* _{ i} ≤ *n*) — the parameters of the copying query. If *t* _{ i} = 2, then the query type is followed by integer *x* _{ i} (1 ≤ *x* _{ i} ≤ *n*) — the position in array *b*.

All numbers in the lines are separated with single spaces. It is guaranteed that all the queries are correct, that is, the copying borders fit into the borders of arrays *a* and *b*.

Output

For each second type query print the result on a single line.

Examples

Input

5 10

1 2 0 -1 3

3 1 5 -2 0

2 5

1 3 3 3

2 5

2 4

2 1

1 2 1 4

2 1

2 4

1 4 2 1

2 2

Output

0

3

-1

3

2

3

-1

Codeforces (c) Copyright 2010-2020 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Aug/08/2020 02:45:34 (g1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|