#include <bits/stdc++.h>
using namespace std;
const int maxn = 4e5 + 10, mod = 1e9 + 7;
const long long INF = 1e9;
int seg[maxn];
int x[maxn], y[maxn], k[maxn];
void update(int ind, int tl, int tr, int l, int r, int x) {
  if (tl >= r || tr <= l) {
    return;
  }
  if (tl >= l && tr <= r) {
    seg[ind] = x;
    return;
  }
  int mid = (tl + tr) / 2;
  update(ind * 2, tl, mid, l, r, x);
  update(ind * 2 + 1, mid, tr, l, r, x);
}
int ii;
void get(int ind, int l, int r, int x) {
  ii = max(ii, seg[ind]);
  if (l == r - 1) {
    return;
  }
  int mid = (l + r) / 2;
  if (mid > x) {
    get(ind * 2, l, mid, x);
  } else {
    get(ind * 2 + 1, mid, r, x);
  }
}
int main() {
  int n, q, t, indx;
  cin >> n >> q;
  int a[n + 1], b[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
  }
  for (int i = 1; i <= q; i++) {
    cin >> t;
    if (t == 1) {
      cin >> x[i] >> y[i] >> k[i];
      update(1, 1, n + 1, y[i], y[i] + k[i], i);
    } else {
      cin >> indx;
      ii = 0;
      get(1, 1, n + 1, indx);
      if (!ii) {
        cout << b[indx] << '\n';
      } else {
        cout << a[indx + x[ii] - y[ii]] << '\n';
      }
    }
  }
}
