#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
const int dv = 500;
int n, m, tp, x, y, k;
int a[maxn], b[maxn];
int t1[dv], t2[maxn];
int tot[dv], sing[maxn];
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]);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &tp);
    if (tp == 1) {
      scanf("%d%d%d", &x, &y, &k);
      x--;
      y--;
      int l = y, r = y + k - 1;
      x = x - y;
      int pos = l;
      while (pos <= r && pos % dv != 0) {
        t2[pos] = i;
        sing[pos] = x;
        pos++;
      }
      while (r - pos + 1 >= dv) {
        t1[pos / dv] = i;
        tot[pos / dv] = x;
        pos += dv;
      }
      for (int j = pos; j <= r; j++) {
        t2[j] = i;
        sing[j] = x;
      }
    } else {
      scanf("%d", &x);
      x--;
      if (t1[x / dv] == 0 && t2[x] == 0)
        printf("%d\n", b[x]);
      else
        printf("%d\n", a[((t1[x / dv] > t2[x]) ? tot[x / dv] : sing[x]) + x]);
    }
  }
  return 0;
}
