#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, cnt, la[N], lb[N], m, k, lzy[N << 2], a[N], b[N], op;
struct node {
  inline void pushdown(int rt) {
    if (lzy[rt]) {
      lzy[rt << 1] = lzy[rt], lzy[rt << 1 | 1] = lzy[rt];
      lzy[rt] = 0;
    }
  }
  inline void update(int L, int R, int val, int l, int r, int rt) {
    if (L <= l && r <= R) {
      lzy[rt] = val;
      return;
    }
    pushdown(rt);
    int mid = (l + r) >> 1;
    if (L <= mid) update(L, R, val, l, mid, rt << 1);
    if (R > mid) update(L, R, val, mid + 1, r, rt << 1 | 1);
  }
  inline int query(int p, int l, int r, int rt) {
    if (l == r) return lzy[rt];
    pushdown(rt);
    int mid = (l + r) >> 1;
    if (p <= mid)
      return query(p, l, mid, rt << 1);
    else
      return query(p, mid + 1, r, rt << 1 | 1);
  }
} T;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 1; i <= n; ++i) scanf("%d", &b[i]);
  while (m--) {
    scanf("%d", &op);
    if (op == 1) {
      ++cnt;
      scanf("%d%d%d", &la[cnt], &lb[cnt], &k);
      T.update(lb[cnt], lb[cnt] + k - 1, cnt, 1, n, 1);
    } else {
      scanf("%d", &k);
      int c = T.query(k, 1, n, 1);
      if (!c)
        printf("%d\n", b[k]);
      else
        printf("%d\n", a[k + la[c] - lb[c]]);
    }
  }
  return 0;
}
