#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000 * 100 + 10, INF = 1000 * 1000 * 1000 + 9;
int a[MAXN], b[MAXN], seg[4 * MAXN], t[MAXN], x[MAXN], y[MAXN], z[MAXN];
void update(int lo, int hi, int val, int cur, int s, int e) {
  if (lo == s && hi == e) {
    seg[cur] = val;
    return;
  }
  int mid = (s + e) / 2;
  if (hi <= mid)
    update(lo, hi, val, cur * 2, s, mid);
  else if (lo >= mid)
    update(lo, hi, val, cur * 2 + 1, mid, e);
  else {
    update(lo, mid, val, cur * 2, s, mid);
    update(mid, hi, val, cur * 2 + 1, mid, e);
  }
}
int getVal(int x, int cur, int s, int e) {
  if (e - s < 2) return seg[cur];
  int mid = (s + e) / 2;
  if (x < mid)
    return max(seg[cur], getVal(x, cur * 2, s, mid));
  else
    return max(seg[cur], getVal(x, cur * 2 + 1, mid, e));
}
int main() {
  int n, m;
  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 < m; i++) {
    cin >> t[i] >> x[i];
    x[i]--;
    if (t[i] == 1) {
      cin >> y[i] >> z[i];
      y[i]--;
      update(y[i], y[i] + z[i], i + 1, 1, 0, n);
    } else {
      int time = getVal(x[i], 1, 0, n);
      if (time == 0)
        cout << b[x[i]] << endl;
      else
        cout << a[x[time - 1] + x[i] - y[time - 1]] << endl;
    }
  }
  return 0;
}
