#include <bits/stdc++.h>
using namespace std;
long long int m[5 * 500002], lazy[5 * 500002];
struct {
  int aval, bval, kval;
} nodes[500002];
void update(int n, int b, int e, int x, int y, int v) {
  if (lazy[n] != 0) {
    if (b != e) {
      lazy[n << 1LL] = lazy[n];
      lazy[(n << 1LL) | 1LL] = lazy[n];
      lazy[n] = 0;
    }
  }
  if (b > y || e < x) return;
  if (b >= x && e <= y) {
    lazy[n] = v;
    return;
  }
  int l = n << 1, mid = (b + e) >> 1;
  update(l, b, mid, x, y, v);
  update(l + 1, mid + 1, e, x, y, v);
}
long long int query(int n, int b, int e, int x) {
  if (lazy[n] != 0) {
    if (b != e) {
      lazy[n << 1LL] = lazy[n];
      lazy[n << 1LL | 1LL] = lazy[n];
      lazy[n] = 0LL;
    }
  }
  if (b == e) {
    return lazy[n];
  }
  int l = n << 1, mid = (b + e) >> 1;
  if (x >= b && x <= mid)
    query(l, b, mid, x);
  else
    query(l + 1, mid + 1, e, x);
}
int main() {
  ios_base::sync_with_stdio(0);
  int n, q;
  cin >> n >> q;
  vector<long long int> a, b;
  long long int temp;
  for (int i = 0; i < n; i++) {
    cin >> temp;
    a.push_back(temp);
  }
  for (int i = 0; i < n; i++) {
    cin >> temp;
    b.push_back(temp);
  }
  int type, u, v, k;
  for (int i = 1; i <= q; i++) {
    cin >> type;
    if (type == 1) {
      cin >> u >> v >> k;
      u--;
      v--;
      nodes[i].aval = u;
      nodes[i].bval = v;
      update(1, 0, n - 1, v, v + k - 1, i);
    } else {
      cin >> k;
      long long int t = query(1, 0, n - 1, k - 1);
      if (t == 0) {
        cout << b[k - 1] << "\n";
      } else {
        cout << a[nodes[t].aval + k - 1 - nodes[t].bval] << "\n";
      }
    }
  }
}
