#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:64000000")
const int MAXN = 1000005;
int n, m;
int t[MAXN << 2];
int A[MAXN];
int B[MAXN];
int type, x, y;
int FA[MAXN], FB[MAXN];
void push(int v) {
  if (t[v] != -1) {
    t[v * 2] = t[v * 2 + 1] = t[v];
    t[v] = -1;
  }
}
void update(int v, int tl, int tr, int l, int r, int color) {
  if (l > r) return;
  if (l == tl && tr == r)
    t[v] = color;
  else {
    push(v);
    int tm = (tl + tr) / 2;
    update(v * 2, tl, tm, l, min(r, tm), color);
    update(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r, color);
  }
}
int get(int v, int tl, int tr, int pos) {
  if (tl == tr) return t[v];
  push(v);
  int tm = (tl + tr) / 2;
  if (pos <= tm)
    return get(v * 2, tl, tm, pos);
  else
    return get(v * 2 + 1, tm + 1, tr, pos);
}
inline void init() {
  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 main() {
  init();
  update(1, 0, n - 1, 0, n - 1, -2);
  for (int i = 0; i < m; ++i) {
    scanf("%d", &type);
    if (type == 2) {
      scanf("%d", &x);
      --x;
      int cur = get(1, 0, n - 1, x);
      if (cur == -2) {
        printf("%d\n", B[x]);
      } else {
        int dif = FB[cur] - FA[cur];
        printf("%d\n", A[x - dif]);
      }
      continue;
    }
    int len;
    scanf("%d%d%d", &x, &y, &len);
    --x, --y;
    FA[i] = x;
    FB[i] = y;
    update(1, 0, n - 1, y, y + len - 1, i);
  }
  return 0;
}
