#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, m, a[N], b[N], id[4 * N], frm[4 * N];
void shift(int x) {
  if (frm[x] == -1) return;
  id[2 * x + 1] = id[x];
  id[2 * x + 2] = id[x];
  frm[2 * x + 1] = frm[x];
  frm[2 * x + 2] = frm[x];
  frm[x] = -1;
}
void change(int x, int xl, int xr, int ql, int qr, int y) {
  if (qr <= xl || xr <= ql) return;
  if (ql <= xl && xr <= qr) {
    frm[x] = ql;
    id[x] = y;
    return;
  }
  shift(x);
  int mid = xl + xr >> 1;
  change(2 * x + 1, xl, mid, ql, qr, y);
  change(2 * x + 2, mid, xr, ql, qr, y);
}
int ask(int x, int xl, int xr, int q) {
  if (q < xl || xr <= q) return -1;
  if (q == xl && q == xr - 1) return (id[x] == -1 ? -1 : id[x] + q - frm[x]);
  shift(x);
  int mid = xl + xr >> 1;
  return max(ask(2 * x + 1, xl, mid, q), ask(2 * x + 2, mid, xr, q));
}
int main() {
  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]);
  int t, x, y, k, p;
  memset(id, -1, sizeof id);
  memset(frm, -1, sizeof frm);
  while (m--) {
    scanf("%d", &t);
    if (t == 1) {
      scanf("%d%d%d", &y, &x, &k);
      y--;
      x--;
      change(0, 0, n, x, x + k, y);
    } else {
      scanf("%d", &x);
      x--;
      p = ask(0, 0, n, x);
      printf("%d\n", (p == -1 ? b[x] : a[p]));
    }
  }
  return 0;
}
