#include <bits/stdc++.h>
using namespace std;
int segtree[1000001];
void build(int node, int l, int r, int low, int high, int i) {
  if (low > r || l > high) return;
  if (l >= low && r <= high) {
    segtree[node] = i;
    return;
  }
  int m = (l + r) / 2;
  build(2 * node + 1, l, m, low, high, i);
  build(2 * node + 2, m + 1, r, low, high, i);
}
int getans(int node, int l, int r, int x) {
  if (x < l || x > r) return 0;
  if (l == r && l == x) return segtree[node];
  int m = (l + r) / 2;
  return max(segtree[node], max(getans(2 * node + 1, l, m, x),
                                getans(2 * node + 2, m + 1, r, x)));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  int a[n];
  int b[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  int x[m + 1];
  int y[m + 1];
  int z[m + 1];
  for (int i = 1; i <= m; i++) {
    int t;
    cin >> t;
    if (t == 1) {
      cin >> x[i] >> y[i] >> z[i];
      x[i]--;
      y[i]--;
      build(0, 0, n - 1, y[i], y[i] + z[i] - 1, i);
    } else {
      int p;
      cin >> p;
      p--;
      int c = getans(0, 0, n - 1, p);
      if (c == 0) {
        cout << b[p] << '\n';
      } else {
        cout << a[p + x[c] - y[c]] << '\n';
      }
    }
  }
}
