#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int seg[4 * N];
void relax(int idx, int midSz) {
  if (seg[idx] == -1) {
    return;
  }
  seg[idx * 2] = seg[idx];
  seg[idx * 2 + 1] = seg[idx] + midSz;
  seg[idx] = -1;
}
void up(int l, int r, int idx, int ql, int qr, int qidx) {
  if (r < ql || qr < l) {
    return;
  }
  if (ql <= l && r <= qr) {
    seg[idx] = qidx + l - ql;
    return;
  }
  int mid = (l + r) / 2;
  relax(idx, mid - l + 1);
  up(l, mid, idx * 2, ql, qr, qidx);
  up(mid + 1, r, idx * 2 + 1, ql, qr, qidx);
}
int qu(int l, int r, int idx, int qidx) {
  if (qidx < l || r < qidx) {
    return -1;
  }
  if (l == r) {
    return seg[idx];
  }
  int mid = (l + r) / 2;
  relax(idx, mid - l + 1);
  return max(qu(l, mid, idx * 2, qidx), qu(mid + 1, r, idx * 2 + 1, qidx));
}
int a[N], b[N];
int main() {
  memset(seg, -1, sizeof seg);
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &b[i]);
  }
  while (m--) {
    int t, x, y, k;
    scanf("%d%d", &t, &x);
    if (t == 1) {
      scanf("%d%d", &y, &k);
      up(0, n - 1, 1, y - 1, y + k - 2, x - 1);
    } else {
      int ret = qu(0, n - 1, 1, x - 1);
      if (ret == -1) {
        printf("%d\n", b[x - 1]);
      } else {
        printf("%d\n", a[ret]);
      }
    }
  }
  return 0;
}
