#include <bits/stdc++.h>
using namespace std;
struct seg {
  int *ind, *L, *R;
  void make(int node, int l, int r) {
    L[node] = l, R[node] = r, ind[node] = -1;
    if (l == r) {
      return;
    }
    make(2 * node, l, (l + r) / 2), make(2 * node + 1, (l + r) / 2 + 1, r);
  }
  seg(int size) {
    size *= 4;
    L = new int[size];
    R = new int[size];
    ind = new int[size];
    make(1, 0, size / 4 - 1);
  }
  int GET(int node, int x) {
    if (L[node] == R[node]) {
      return ind[node];
    }
    if (x <= R[2 * node]) {
      return max(GET(2 * node, x), ind[node]);
    }
    return max(GET(2 * node + 1, x), ind[node]);
  }
  int get_ind(int x) { return GET(1, x); }
  void SET(int node, int l, int r, int v) {
    if (L[node] == l && R[node] == r) {
      ind[node] = v;
      return;
    }
    int mid = R[2 * node];
    if (r <= mid) {
      SET(2 * node, l, r, v);
    } else if (l > mid) {
      SET(2 * node + 1, l, r, v);
    } else {
      SET(2 * node, l, mid, v), SET(2 * node + 1, mid + 1, r, v);
    }
  }
  void set(int l, int r, int v) { SET(1, l, r, v); }
  ~seg() {
    delete[] ind;
    delete[] L;
    delete[] R;
  }
};
const int maxn = 100 * 1000 + 1;
int n, m, A[maxn], B[maxn];
pair<int, pair<int, int> > Q[maxn];
int find(int ind, int x) {
  int g = x - Q[ind].second.first;
  return A[Q[ind].first + g];
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> B[i];
  }
  seg S(n);
  for (int i = 0; i < m; i++) {
    int type, x, y, k;
    cin >> type >> x;
    x--;
    if (type == 2) {
      int g = S.get_ind(x);
      if (g == -1) {
        cout << B[x] << endl;
      } else {
        cout << find(g, x) << endl;
      }
    } else {
      cin >> y >> k;
      y--;
      Q[i] = make_pair(x, make_pair(y, k));
      S.set(y, y + k - 1, i);
    }
  }
  cerr << "";
}
