#include <bits/stdc++.h>
using namespace std;
const int Maxn = 1000 * 100 + 10;
struct node {
  int fa, t, k, fb;
  node() { fa = fb = t = -1; }
};
int n, m;
int a[Maxn], b[Maxn];
node seg[Maxn * 4];
void up(int f, int l, int tag, int fa, int fb, int k, int t) {
  int s = fb, e = fb + k;
  if (s >= l || e <= f) return;
  if (s <= f && e >= l) {
    seg[tag].fa = fa;
    seg[tag].t = t;
    seg[tag].k = k;
    seg[tag].fb = fb;
    return;
  }
  int mid = (f + l) / 2;
  up(f, mid, 2 * tag, fa, fb, k, t);
  up(mid, l, 2 * tag + 1, fa, fb, k, t);
}
pair<int, int> get(int f, int l, int tag, int pos) {
  if (f == l - 1) {
    if (seg[tag].t == -1) return make_pair(-1, -1);
    return make_pair(seg[tag].t, pos - seg[tag].fb + seg[tag].fa);
  }
  int mid = (f + l) / 2;
  pair<int, int> ans;
  if (pos < mid)
    ans = get(f, mid, 2 * tag, pos);
  else
    ans = get(mid, l, 2 * tag + 1, pos);
  return max(ans, make_pair(seg[tag].t, pos - seg[tag].fb + seg[tag].fa));
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  for (int i = 0; i < 4 * Maxn; i++)
    seg[i].t = seg[i].fa = seg[i].fb = seg[i].k = seg[i].t = -1;
  for (int i = 1; i <= m; i++) {
    int t;
    cin >> t;
    if (t == 1) {
      int x, y, z;
      cin >> x >> y >> z;
      up(0, n, 1, x - 1, y - 1, z, i);
    } else {
      int pos;
      cin >> pos;
      pair<int, int> res = get(0, n, 1, pos - 1);
      if (res.first >= 0)
        cout << a[res.second] << endl;
      else
        cout << b[pos - 1] << endl;
    }
  }
}
