#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007, dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
const double eps = 1e-8;
void read(int &k) {
  k = 0;
  char x = getchar();
  while (x < '0' || x > '9') x = getchar();
  while (x >= '0' && x <= '9') {
    k = k * 10 - 48 + x;
    x = getchar();
  }
}
int n, m, k, x, y, type, A[100010], B[100010];
struct SegmentTree {
  pair<pair<int, int>, int> c[400000];
  void ins(int L, int R, int l, int r, int mx, int my, int T, int now) {
    if (L == l && R == r) {
      c[now] = make_pair(make_pair(mx, my), T);
      return;
    }
    int t = (L + R) >> 1;
    if (r <= t)
      ins(L, t, l, r, mx, my, T, now * 2);
    else if (l > t)
      ins(t + 1, R, l, r, mx, my, T, now * 2 + 1);
    else
      ins(L, t, l, t, mx, my, T, now * 2),
          ins(t + 1, R, t + 1, r, mx, my, T, now * 2 + 1);
  }
  pair<int, int> ask(int L, int R, int x, int now) {
    pair<int, int> ret = make_pair(0, B[x]);
    if (c[now].second > 0)
      ret = make_pair(c[now].second,
                      A[c[now].first.first + x - c[now].first.second]);
    if (L == R) return ret;
    int t = (L + R) >> 1;
    if (x <= t)
      return max(ret, ask(L, t, x, now * 2));
    else
      return max(ret, ask(t + 1, R, x, now * 2 + 1));
  }
} xds;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &k);
    A[i] = k;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &k);
    B[i] = k;
  }
  for (int T = 1; T <= m; T++) {
    scanf("%d", &type);
    if (type == 1) {
      scanf("%d%d%d", &x, &y, &k);
      xds.ins(1, n, y, y + k - 1, x, y, T, 1);
    } else if (type == 2) {
      scanf("%d", &x);
      cout << xds.ask(1, n, x, 1).second << endl;
    }
  }
  return 0;
}
