#include <bits/stdc++.h>
const int SIZE_N = 100000 + 10;
const int SIZE_M = 100000 + 10;
int n, m;
int ary[SIZE_N * 2];
struct node {
  int le, ri, lc, rc;
  int ful, val;
  void show(void) { printf("%d %d %d %d %d %d\n", le, ri, lc, rc, ful, val); }
};
node tree[SIZE_N * 4];
int nno;
int init(int le, int ri) {
  int now = nno + 1;
  ++nno;
  tree[now].le = le, tree[now].ri = ri;
  tree[now].lc = tree[now].rc = 0;
  tree[now].ful = tree[now].val = 0;
  if (le == ri) return now;
  int mi = (le + ri >> 1);
  tree[now].lc = init(le, mi);
  tree[now].rc = init(mi + 1, ri);
  return now;
}
void update(int now, int ql, int qr, int val) {
  if (qr < ql) return;
  int le = tree[now].le, ri = tree[now].ri, lc = tree[now].lc,
      rc = tree[now].rc;
  int mi = (le + ri >> 1);
  if (ql == le && qr == ri) {
    tree[now].ful = 1, tree[now].val = val;
  } else {
    tree[now].ful = 0;
    if (lc != 0) update(lc, ql, std::min(qr, mi), val);
    if (rc != 0) update(rc, std::max(ql, mi + 1), qr, val);
  }
}
int query(int now, int qx) {
  int le = tree[now].le, ri = tree[now].ri, lc = tree[now].lc,
      rc = tree[now].rc;
  int mi = (le + ri >> 1);
  if (qx <= mi && lc != 0) return std::max(tree[now].val, query(lc, qx));
  if (mi + 1 <= qx && rc != 0) return std::max(tree[now].val, query(rc, qx));
  return tree[now].val;
}
int que[SIZE_M];
int main(void) {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", ary + i);
  for (int i = 1; i <= n; ++i) scanf("%d", ary + n + i);
  nno = 0;
  init(1, n);
  update(1, 1, n, 0);
  que[0] = n;
  for (int count = 0, t, x, y, k; count < m; ++count) {
    scanf("%d", &t);
    if (t == 2) {
      scanf("%d", &x);
      int tem = query(1, x);
      tem = que[tem];
      printf("%d\n", ary[tem + x]);
    } else {
      scanf("%d%d%d", &x, &y, &k);
      update(1, y, y + k - 1, count + 1);
      que[count + 1] = x - y;
    }
  }
  return 0;
}

### Prompt

Please create a solution in Cpp to the following problem:

We 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 a1, a2, ..., an and b1, b2, ..., bn of length n. Also, you've got m queries of two types:

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



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 ≤ 105) — the number of elements in the arrays and the number of queries, correspondingly. The second line contains an array of integers a1, a2, ..., an (|ai| ≤ 109). The third line contains an array of integers b1, b2, ..., bn (|bi| ≤ 109).

Next m lines contain the descriptions of the queries. The i-th line first contains integer ti — the type of the i-th query (1 ≤ ti ≤ 2). If ti = 1, then the i-th query means the copying operation. If ti = 2, then the i-th query means taking the value in array b. If ti = 1, then the query type is followed by three integers xi, yi, ki (1 ≤ xi, yi, ki ≤ n) — the parameters of the copying query. If ti = 2, then the query type is followed by integer xi (1 ≤ xi ≤ 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

### Response

```cpp
#include <bits/stdc++.h>
const int SIZE_N = 100000 + 10;
const int SIZE_M = 100000 + 10;
int n, m;
int ary[SIZE_N * 2];
struct node {
  int le, ri, lc, rc;
  int ful, val;
  void show(void) { printf("%d %d %d %d %d %d\n", le, ri, lc, rc, ful, val); }
};
node tree[SIZE_N * 4];
int nno;
int init(int le, int ri) {
  int now = nno + 1;
  ++nno;
  tree[now].le = le, tree[now].ri = ri;
  tree[now].lc = tree[now].rc = 0;
  tree[now].ful = tree[now].val = 0;
  if (le == ri) return now;
  int mi = (le + ri >> 1);
  tree[now].lc = init(le, mi);
  tree[now].rc = init(mi + 1, ri);
  return now;
}
void update(int now, int ql, int qr, int val) {
  if (qr < ql) return;
  int le = tree[now].le, ri = tree[now].ri, lc = tree[now].lc,
      rc = tree[now].rc;
  int mi = (le + ri >> 1);
  if (ql == le && qr == ri) {
    tree[now].ful = 1, tree[now].val = val;
  } else {
    tree[now].ful = 0;
    if (lc != 0) update(lc, ql, std::min(qr, mi), val);
    if (rc != 0) update(rc, std::max(ql, mi + 1), qr, val);
  }
}
int query(int now, int qx) {
  int le = tree[now].le, ri = tree[now].ri, lc = tree[now].lc,
      rc = tree[now].rc;
  int mi = (le + ri >> 1);
  if (qx <= mi && lc != 0) return std::max(tree[now].val, query(lc, qx));
  if (mi + 1 <= qx && rc != 0) return std::max(tree[now].val, query(rc, qx));
  return tree[now].val;
}
int que[SIZE_M];
int main(void) {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", ary + i);
  for (int i = 1; i <= n; ++i) scanf("%d", ary + n + i);
  nno = 0;
  init(1, n);
  update(1, 1, n, 0);
  que[0] = n;
  for (int count = 0, t, x, y, k; count < m; ++count) {
    scanf("%d", &t);
    if (t == 2) {
      scanf("%d", &x);
      int tem = query(1, x);
      tem = que[tem];
      printf("%d\n", ary[tem + x]);
    } else {
      scanf("%d%d%d", &x, &y, &k);
      update(1, y, y + k - 1, count + 1);
      que[count + 1] = x - y;
    }
  }
  return 0;
}

```