#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[100010], b[100010];
int ll[3 * 100010], rr[100010 * 3], aa[100010 * 3], xx[100010 * 3];
void down(int i) {
  aa[i << 1] = aa[i << 1 | 1] = aa[i];
  xx[i << 1] = xx[i << 1 | 1] = xx[i];
  aa[i] = xx[i] = 0;
}
void build(int i, int l, int r) {
  ll[i] = l;
  rr[i] = r;
  if (l == r) return;
  int mid = l + r >> 1;
  build(i << 1, l, mid);
  build(i << 1 | 1, mid + 1, r);
}
void jia(int i, int l, int r, int x, int y, int k) {
  if (l == ll[i] && r == rr[i]) {
    aa[i] = x;
    xx[i] = y;
    return;
  }
  if (aa[i] && xx[i]) down(i);
  int mid = ll[i] + rr[i] >> 1;
  if (r <= mid)
    jia(i << 1, l, r, x, y, k);
  else if (l > mid)
    jia(i << 1 | 1, l, r, x, y, k);
  else {
    jia(i << 1, l, mid, x, y, k);
    jia(i << 1 | 1, mid + 1, r, x, y, k);
  }
}
int qiu(int i, int x) {
  if (ll[i] == rr[i] && ll[i] == x) {
    if (aa[i] == 0 && xx[i] == 0)
      return b[x];
    else
      return a[x - xx[i] + aa[i]];
  }
  if (aa[i] && xx[i]) down(i);
  int mid = ll[i] + rr[i] >> 1;
  if (mid >= x) return qiu(i << 1, x);
  if (mid + 1 <= x) return qiu(i << 1 | 1, x);
}
int main() {
  int k, x, y;
  scanf("%d%d", &n, &m);
  for (int j = 1; j <= n; j++) scanf("%d", &a[j]);
  for (int j = 1; j <= n; j++) scanf("%d", &b[j]);
  build(1, 1, n);
  for (int j = 0; j < m; j++) {
    scanf("%d", &k);
    if (k == 1) {
      scanf("%d%d%d", &x, &y, &k);
      k = min(k, n - y + 1);
      jia(1, y, y + k - 1, x, y, k);
    } else {
      scanf("%d", &x);
      printf("%d\n", qiu(1, x));
    }
  }
  return 0;
}
