#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
struct tOp {
  int xi, yi, ki;
};
struct SegmentTree {
  int n, h;
  vi t;
  SegmentTree(int num) {
    n = num;
    h = ceil(log2(num));
    t.assign(2 * n, -1);
  }
  void push(int l, int r) {
    int s = h;
    for (l += n, r += n - 1; s > 0; --s)
      for (int i = l >> s; i <= r >> s; ++i)
        if (t[i] != -1) {
          t[2 * i] = t[i];
          t[2 * i + 1] = t[i];
          t[i] = -1;
        }
  }
  int query(int p) {
    push(p, p + 1);
    return t[n + p];
  }
  void modify(int l, int r, int value) {
    push(l, l + 1);
    push(r - 1, r);
    l += n;
    r += n;
    for (; l < r; l /= 2, r /= 2) {
      if (l % 2 == 1) t[l++] = value;
      if (r % 2 == 1) t[--r] = value;
    }
  }
};
int main() {
  int n, m;
  cin >> n >> m;
  SegmentTree st(n);
  vi a(n), b(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) cin >> b[i];
  int cont = 0;
  vector<tOp> v;
  for (int i = 0; i < m; ++i) {
    int t;
    cin >> t;
    if (t == 1) {
      int x, y, k;
      cin >> x >> y >> k;
      --x;
      --y;
      st.modify(y, y + k, cont);
      tOp aux = {x, y, k};
      v.push_back(aux);
      ++cont;
    } else {
      int p;
      cin >> p;
      --p;
      int res = st.query(p);
      if (res == -1)
        cout << b[p] << '\n';
      else {
        cout << a[v[res].xi + p - v[res].yi] << '\n';
      }
    }
  }
  return 0;
}
