#include <bits/stdc++.h>
using namespace std;
const int sz = 1e5 + 1;
int tree[sz << 2];
void com(int node, int low, int high) {
  int mid = (low + high) >> 1, left = node << 1, right = left | 1;
  tree[left] = tree[node];
  tree[right] = tree[left] + mid + 1 - low;
  tree[node] = -1;
}
void update(int node, int low, int high, int x, int y, int k) {
  if (low > y || high < x) return;
  if (x <= low && high <= y) return void(tree[node] = k + low - x);
  if (tree[node] != -1) com(node, low, high);
  int mid = (low + high) >> 1, left = node << 1, right = left | 1;
  update(left, low, mid, x, y, k), update(right, mid + 1, high, x, y, k);
}
int query(int node, int low, int high, int x) {
  if (low == high) return tree[node];
  if (tree[node] != -1) com(node, low, high);
  int mid = (low + high) >> 1, left = node << 1, right = left | 1;
  if (x <= mid)
    return query(left, low, mid, x);
  else
    return query(right, mid + 1, high, x);
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  memset(tree, -1, sizeof(tree));
  int a[n + 1], b[n + 1];
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) scanf("%d", &b[i]);
  while (m--) {
    int t, x;
    scanf("%d%d", &t, &x);
    if (t == 1) {
      int y, k;
      scanf("%d%d", &y, &k);
      y--, x--;
      update(1, 0, n - 1, y, y + k - 1, x);
    } else {
      int ans = query(1, 0, n - 1, x - 1);
      if (ans == -1)
        ans = b[x - 1];
      else
        ans = a[ans];
      printf("%d\n", ans);
    }
  }
  return 0;
}
