#include <bits/stdc++.h>
using namespace std;
const int lim = 1e5 + 10;
int arr[lim], brr[lim];
int seg[4 * lim] = {};
int n, m, q;
vector<pair<int, int> > vp;
void update(int idx, int p = 1, int l = 0, int r = n - 1) {
  int y = vp[idx - 1].second - 1;
  if (y + q <= l or y > r) return;
  if (y <= l and r <= y + q - 1) {
    seg[p] = idx;
    return;
  } else {
    if (seg[p] > 0) {
      seg[p << 1] = seg[p];
      seg[p << 1 | 1] = seg[p];
      seg[p] = 0;
    }
    update(idx, p << 1, l, (l + r) / 2);
    update(idx, p << 1 | 1, (l + r) / 2 + 1, r);
  }
}
int rmq(int pos, int p = 1, int l = 0, int r = n - 1) {
  if (seg[p] > 0) return seg[p];
  if (l == r) return seg[p];
  int m = (l + r) / 2;
  if (pos <= m) return rmq(pos, p << 1, l, (l + r) / 2);
  return rmq(pos, p << 1 | 1, (l + r) / 2 + 1, r);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &arr[i]);
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", &brr[i]);
  }
  for (int i = 0; i < m; ++i) {
    int t;
    scanf("%d", &t);
    if (t == 1) {
      int x, y;
      scanf("%d%d%d", &x, &y, &q);
      vp.emplace_back(x, y);
      update(vp.size());
    } else {
      int x;
      scanf("%d", &x);
      int ans = rmq(x - 1);
      if (ans == 0)
        printf("%d\n", brr[x - 1]);
      else
        printf("%d\n", arr[vp[ans - 1].first + (x - vp[ans - 1].second) - 1]);
    }
  }
}
