#include <bits/stdc++.h>
using namespace std;
int const N = 1 << 17, INF = 1e9;
int a[N], b[N], t[2 * N];
void SET(int v, int vl, int vr, int l, int r, int x) {
  if (vr < l || r < vl) return;
  if (l <= vl && vr <= r) {
    t[v] = x;
    return;
  }
  if (t[v] != INF) {
    t[v * 2] = t[v * 2 + 1] = t[v];
    t[v] = INF;
  }
  int vm = (vl + vr) / 2;
  SET(v * 2, vl, vm, l, r, x);
  SET(v * 2 + 1, vm + 1, vr, l, r, x);
}
int main() {
  int n, m;
  for (int i = 0; i < N * 2; i++) t[i] = INF;
  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]);
  for (int i = 0; i < m; i++) {
    int type;
    scanf("%d", &type);
    if (type == 2) {
      int x, q;
      scanf("%d", &x), x--;
      q = b[x];
      for (int j = N + x; j > 0; j /= 2)
        if (t[j] != INF) q = a[x + t[j]];
      printf("%d\n", q);
    } else {
      int x, y, k;
      scanf("%d%d%d", &x, &y, &k), x--, y--;
      SET(1, 0, N - 1, y, y + k - 1, x - y);
    }
  }
  return 0;
}
