#include <bits/stdc++.h>
using namespace std;
const int maxn = (1 << 18);
int n, m;
int a[maxn], b[maxn];
int delta[maxn];
int tree[maxn * 4];
void update(int v, int cl, int cr, int l, int r, int val) {
  if (cl >= l && cr <= r) {
    tree[v] = val;
    return;
  }
  if (tree[v] < m) tree[v * 2] = tree[v], tree[v * 2 + 1] = tree[v];
  int mid = cl + cr >> 1;
  if (mid >= l) update(v * 2, cl, mid, l, r, val);
  if (mid < r) update(v * 2 + 1, mid + 1, cr, l, r, val);
  if (tree[v * 2] == tree[v * 2 + 1])
    tree[v] = tree[v * 2];
  else
    tree[v] = m;
}
int query(int v, int cl, int cr, int key) {
  if (tree[v] < m) {
    return tree[v];
  }
  if (tree[v] < m) tree[v * 2] = tree[v], tree[v * 2 + 1] = tree[v];
  int mid = cl + cr >> 1;
  if (key <= mid) return query(v * 2, cl, mid, key);
  return query(v * 2 + 1, mid + 1, cr, key);
}
int main() {
  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]);
  memset(tree, -1, sizeof(tree));
  for (int i = 0; i < m; i++) {
    int c, x;
    scanf("%d%d", &c, &x);
    if (c == 1) {
      int y, k;
      scanf("%d%d", &y, &k);
      delta[i] = x - y;
      update(1, 1, n, y, y + k - 1, i);
    } else {
      int pos = x;
      int tmp = query(1, 1, n, pos);
      if (tmp == -1)
        printf("%d\n", b[pos]);
      else
        printf("%d\n", a[pos + delta[tmp]]);
    }
  }
  return 0;
}
