#include <bits/stdc++.h>
using namespace std;
const int MAXN = (int)1e5 + 10;
int n, m, a[MAXN], b[MAXN];
int t[4 * MAXN];
int X[MAXN], Y[MAXN];
int lg() {
  int l = 1;
  while (l <= n) l *= 2;
  return l;
}
void push(int v, int l, int r) {
  if (l != r) {
    t[2 * v + 1] = t[v];
    t[2 * v + 2] = t[v];
    t[v] = 0;
  }
}
int get(int v, int l, int r, int pos) {
  lg();
  if (t[v] != 0) {
    push(v, l, r);
  }
  if (l == r) {
    return t[v];
  } else {
    int mid = (l + r) / 2;
    if (pos <= mid)
      return get(2 * v + 1, l, mid, pos);
    else
      return get(2 * v + 2, mid + 1, r, pos);
  }
}
void update(int v, int l, int r, int ql, int qr, int val) {
  lg();
  if (t[v] != 0) {
    push(v, l, r);
  }
  if (ql <= l && r <= qr) {
    t[v] = val;
  } else if (ql > r || l > qr) {
    return;
  } else {
    int mid = (l + r) / 2;
    update(2 * v + 1, l, mid, ql, qr, val);
    update(2 * v + 2, mid + 1, r, ql, qr, val);
  }
}
int main() {
  for (int i = 0; i < 4 * MAXN; ++i) {
    t[i] = 0;
  }
  scanf("%d%d", &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 op, i, x, y, k;
  int upd_ind = 1;
  ostringstream ss;
  for (int mm = 0; mm < m; ++mm) {
    scanf("%d", &op);
    switch (op) {
      case 1:
        scanf("%d%d%d", &x, &y, &k);
        x--, y--;
        X[upd_ind] = x;
        Y[upd_ind] = y;
        update(0, 0, n - 1, y, y + k - 1, upd_ind);
        upd_ind++;
        break;
      case 2:
        scanf("%d", &i);
        i--;
        int q = get(0, 0, n - 1, i);
        if (q == 0) {
          ss << b[i] << "\n";
        } else {
          ss << a[i - Y[q] + X[q]] << "\n";
        }
        break;
    }
  }
  cout << ss.str();
  return 0;
}
