#include <bits/stdc++.h>
using namespace std;
int n, Q;
int a[101000], b[100100], x[101000], y[101000], col[101000 << 2];
void pushdown(int rt) {
  if (col[rt]) col[rt << 1] = col[rt << 1 | 1] = col[rt];
  col[rt] = 0;
}
void update(int L, int R, int l, int r, int rt, int c) {
  if (L <= l && r <= R) {
    col[rt] = c;
    return;
  }
  int mid = l + r >> 1;
  pushdown(rt);
  if (L <= mid) update(L, R, l, mid, rt << 1, c);
  if (mid < R) update(L, R, mid + 1, r, rt << 1 | 1, c);
}
int query(int pos, int l, int r, int rt) {
  if (l == r) return col[rt];
  int mid = l + r >> 1;
  pushdown(rt);
  if (pos <= mid)
    return query(pos, l, mid, rt << 1);
  else
    return query(pos, mid + 1, r, rt << 1 | 1);
}
int main() {
  scanf("%d%d", &n, &Q);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
  for (int i = 1, z, t; i <= Q; i++) {
    scanf("%d", &t);
    if (t == 1) {
      scanf("%d%d%d", &x[i], &y[i], &z);
      update(y[i], y[i] + z - 1, 1, n, 1, i);
    }
    if (t == 2) {
      scanf("%d", &z);
      int loc = query(z, 1, n, 1);
      if (!loc)
        printf("%d\n", b[z]);
      else
        printf("%d\n", a[x[loc] + z - y[loc]]);
    }
  }
  return 0;
}
