#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  int a[n + 1], b[n + 1], d[m + 1];
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= n; ++i) cin >> b[i];
  int s = 1;
  while (s <= n) s <<= 1;
  vector<int> c(s + n + 1);
  int t, x, y, k;
  for (int i = 1; i <= m; ++i) {
    cin >> t;
    if (t == 1) {
      cin >> x >> y >> k;
      d[i] = x - y;
      for (int l = s + y, r = s + y + k - 1; l <= r;
           l = (l + 1) / 2, r = (r - 1) / 2)
        c[l] = c[r] = i;
    } else {
      cin >> x;
      int p = 0;
      for (int j = s + x; j > 0; j >>= 1) p = max(p, c[j]);
      cout << (p ? a[x + d[p]] : b[x]) << '\n';
    }
  }
  return 0;
}
