#include <bits/stdc++.h>
using namespace std;
int type, pos, len, start[100020], dest[100020], a[100020], b[100020], q, n,
    seg[4 * 100020];
bool mark[4 * 100020];
void setVal(int v, int vl, int vr, int val, int l, int r) {
  if (l <= vl && vr <= r) {
    seg[v] = max(seg[v], val);
    mark[v] = true;
    return;
  }
  if (r < vl || l > vr || vl == vr) return;
  if (mark[v]) {
    mark[v] = false;
    mark[2 * v] = mark[2 * v + 1] = true;
    seg[2 * v] = max(seg[2 * v], seg[v]);
    seg[2 * v + 1] = max(seg[2 * v + 1], seg[v]);
  }
  int mid = (vl + vr) / 2;
  setVal(2 * v, vl, mid, val, l, r);
  setVal(2 * v + 1, mid + 1, vr, val, l, r);
  seg[v] = max(seg[2 * v], seg[2 * v + 1]);
}
int getVal(int v, int vl, int vr, int p) {
  int mid = (vl + vr) / 2;
  if (vl == vr) return seg[v];
  if (mark[v]) {
    mark[v] = false;
    mark[2 * v] = mark[2 * v + 1] = true;
    seg[2 * v] = max(seg[2 * v], seg[v]);
    seg[2 * v + 1] = max(seg[2 * v + 1], seg[v]);
  }
  if (p <= mid)
    return getVal(2 * v, vl, mid, p);
  else
    return getVal(2 * v + 1, mid + 1, vr, p);
}
int main() {
  scanf("%d %d", &n, &q);
  for (__typeof(n) i = (1); i <= (n); i++) scanf("%d", &b[i]);
  for (__typeof(n) i = (1); i <= (n); i++) scanf("%d", &a[i]);
  for (__typeof(q) i = (1); i <= (q); i++) {
    scanf("%d", &type);
    if (type == 2) {
      scanf("%d", &pos);
      int idx = getVal(1, 1, n, pos);
      if (idx == 0)
        printf("%d\n", a[pos]);
      else
        printf("%d\n", b[start[idx] + pos - dest[idx]]);
    } else {
      scanf("%d %d %d", &start[i], &dest[i], &len);
      setVal(1, 1, n, i, dest[i], dest[i] + len - 1);
    }
  }
  return 0;
}
