#include <bits/stdc++.h>
using namespace std;
int n;
int tree[400005];
int a[400005];
int b[400005];
int lazy[400005];
int X[400005], y[400005], k[400005];
int lft(int x) { return 2 * x + 1; }
int ryt(int x) { return 2 * x + 2; }
void upd(int x, int val) {
  tree[x] = val;
  lazy[x] = val;
}
void laze(int x, int l, int r) {
  if (lazy[x] == 0) return;
  int mid = (r + l) / 2;
  if (l != r) {
    upd(lft(x), lazy[x]);
    upd(ryt(x), lazy[x]);
  }
  lazy[x] = 0;
}
void prop(int x, int l, int r, int a, int b, int value) {
  if (r < a || l > b) return;
  if (l >= a && r <= b) {
    upd(x, value);
    return;
  }
  laze(x, l, r);
  int mid = (l + r) / 2;
  prop(lft(x), l, mid, a, b, value);
  prop(ryt(x), mid + 1, r, a, b, value);
}
int query(int x, int l, int r, int a, int b) {
  if (l > b || r < a) return 0;
  if (l >= a && r <= b) {
    return tree[x];
  }
  laze(x, l, r);
  int mid = (l + r) / 2;
  return query(lft(x), l, mid, a, b) + query(ryt(x), mid + 1, r, a, b);
}
int main() {
  int n, m;
  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]);
  }
  for (int i = 1; i <= m; i++) {
    int c;
    scanf("%d", &c);
    if (c == 1) {
      scanf("%d%d%d", &X[i], &y[i], &k[i]);
      prop(0, 1, n, y[i], y[i] + k[i] - 1, i);
    } else {
      int x;
      scanf("%d", &x);
      int temp = query(0, 1, n, x, x);
      if (!temp)
        printf("%d\n", b[x]);
      else
        printf("%d\n", a[x - y[temp] + X[temp]]);
    }
  }
}
