#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[100001] = {0};
int b[100001] = {0};
vector<pair<int, int> > newlr;
int len;
int s[100101] = {0};
int B[200101] = {0};
void rewr(int idblock) {
  if (B[idblock] == 0) return;
  int l = idblock * len;
  int r = (idblock + 1) * len - 1;
  for (int i = l; i <= r; i++) {
    s[i] = B[idblock];
  }
  B[idblock] = 0;
}
void mod(int l, int r, int u) {
  int left = l / len;
  int right = r / len;
  if (left == right) {
    rewr(left);
    for (int i = l; i <= r; i++) s[i] = u;
  } else {
    int end = (left + 1) * len - 1;
    if (l <= end) {
      rewr(left);
      for (int i = l; i <= end; i++) s[i] = u;
    }
    for (int i = left + 1; i <= right - 1; i++) B[i] = u;
    if (right * len <= r) {
      rewr(right);
      for (int i = right * len; i <= r; i++) s[i] = u;
    }
  }
}
int get(int p) {
  int ind = p / len;
  if (B[ind] != 0) return B[ind];
  return s[p];
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) scanf("%d", &b[i]);
  int q, x, y, k;
  int it = 1;
  len = 50;
  for (int i = 0; i < m; i++) {
    scanf("%d", &q);
    if (q == 2) {
      scanf("%d", &q);
      --q;
      int v = get(q);
      if (v == 0)
        printf("%d\n", b[q]);
      else {
        int d = q - newlr[v - 1].second;
        q = newlr[v - 1].first + d;
        printf("%d\n", a[q]);
      }
    } else {
      scanf("%d%d%d", &x, &y, &k);
      int lb = y - 1;
      int la = x - 1;
      newlr.push_back(make_pair(la, lb));
      int rb = lb + k - 1;
      mod(lb, rb, it);
      it++;
    }
  }
  return 0;
}
