#include <bits/stdc++.h>
using namespace std;
int nb;
int n, m, k;
int t[300000 + 5];
int t1[300000 + 5];
int lz[300000 + 5];
void update(int node, int l1, int r1, int l, int r, int val) {
  if ((l > r1) || (r < l1)) return;
  if ((l1 >= l) && (r1 <= r)) {
    lz[node] = val;
    return;
  }
  int mid = (l1 + r1) >> 1;
  if (lz[node] != 1000000007) {
    lz[2 * node + 1] = lz[node];
    lz[2 * node] = lz[node];
    lz[node] = 1000000007;
  }
  update(2 * node, l1, mid, l, r, val);
  update(2 * node + 1, mid + 1, r1, l, r, val);
}
int query(int node, int l, int r, int a) {
  if (l == r) return lz[node];
  if (lz[node] != 1000000007) return lz[node];
  int mid = (l + r) >> 1;
  if (a <= mid) return query(2 * node, l, mid, a);
  return query(2 * node + 1, mid + 1, r, a);
}
int main() {
  int h = 0;
  cin >> nb >> m;
  for (int i = 0; i < nb; i++) cin >> t[i];
  for (int i = 0; i < nb; i++) cin >> t1[i];
  n = nb;
  while (n) {
    n >>= 1;
    h++;
  }
  n = (1 << h);
  for (int i = 1; i <= 2 * n - 1; i++) lz[i] = 1000000007;
  for (int i = 0; i < m; i++) {
    int a;
    int b, c, d;
    cin >> a;
    if (a == 1) {
      cin >> b >> c >> d;
      b--, c--;
      update(1, 0, n - 1, c, min(c + d - 1, n - 1), b - c);
    } else {
      cin >> b;
      b--;
      int p = query(1, 0, n - 1, b);
      if (p != 1000000007)
        cout << t[p + b];
      else
        cout << t1[b];
      cout << '\n';
    }
  }
}
