#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6;
int a[maxn], b[maxn];
int seg[maxn];
pair<int, int> Q[maxn];
void upd(int id, int b, int e, int l, int r, int val) {
  if (r <= b || l >= e) return;
  if (l <= b && r >= e) {
    seg[id] = val;
    return;
  }
  int mid = (b + e) / 2;
  upd(id * 2, b, mid, l, r, val);
  upd(id * 2 + 1, mid, e, l, r, val);
}
int get(int id, int B, int e, int out, int mx) {
  if (e - B == 1) {
    mx = max(seg[id], mx);
    if (mx == 0) return b[B];
    return a[Q[mx].first + B - Q[mx].second];
  }
  mx = max(seg[id], mx);
  int mid = (B + e) / 2;
  if (out < mid) return get(id * 2, B, mid, out, mx);
  return get(id * 2 + 1, mid, e, out, mx);
}
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];
  }
  int mer = 1;
  while (m--) {
    int t, x, y, k;
    cin >> t >> x;
    if (t == 2) {
      cout << get(1, 0, n, x - 1, 0) << endl;
    } else {
      cin >> y >> k;
      Q[mer] = {x - 1, y - 1};
      upd(1, 0, n, y - 1, y + k - 1, mer);
      mer++;
    }
  }
}
