#include <bits/stdc++.h>
using namespace std;
int a[100005], b[100005], lazy[100005 * 4], x;
void update(int pos, int b, int e, int i, int j) {
  int m = (b + e) / 2;
  int l = pos * 2;
  int r = l + 1;
  if (lazy[pos] != 0) {
    if (b != e) {
      lazy[l] = lazy[pos];
      lazy[r] = lazy[pos] + (m - b + 1);
      lazy[pos] = 0;
    }
  }
  if (b > e || b > j || e < i) return;
  if (b >= i && e <= j) {
    lazy[pos] = (b - i) + x;
    return;
  }
  update(l, b, m, i, j);
  update(r, m + 1, e, i, j);
}
int query(int pos, int b, int e, int i, int j) {
  int m = (b + e) / 2;
  int l = pos * 2;
  int r = l + 1;
  if (lazy[pos] != 0) {
    if (b != e) {
      lazy[l] = lazy[pos];
      lazy[r] = lazy[pos] + (m - b + 1);
      lazy[pos] = 0;
    }
  }
  if (b > e || b > j || e < i) return 0;
  if (b >= i && e <= j) {
    return lazy[pos];
  }
  return (query(l, b, m, i, j) + query(r, m + 1, e, i, j));
}
int main() {
  int n, m, typ, k, y;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
  while (m--) {
    scanf("%d", &typ);
    if (typ == 1) {
      scanf("%d%d%d", &x, &y, &k);
      update(1, 1, 100005 - 1, y, y + k - 1);
    } else {
      scanf("%d", &k);
      int id = query(1, 1, 100005 - 1, k, k);
      if (id == 0)
        printf("%d\n", b[k]);
      else
        printf("%d\n", a[id]);
    }
  }
  return 0;
}
