#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
const double EPS = 1e-8;
const double PI = acos(-1);
const int MAX_N = 200000;
struct SegMax {
  int data[MAX_N * 4 - 1];
  int datb[MAX_N * 4 - 1];
  int n;
  void ini(int _n) {
    for (n = 1; n < _n; n *= 2)
      ;
    for (int i = 0; i < (int)2 * n - 1; ++i) data[i] = datb[i] = -1;
  }
  void add(int a, int b, int x) { add(a, b, x, 0, 0, n); }
  void add(int a, int b, int x, int k, int l, int r) {
    if (a <= l && r <= b) {
      data[k] = max(data[k], x);
      datb[k] = max(datb[k], x);
    } else if (l < b && a < r) {
      add(a, b, x, k * 2 + 1, l, (l + r) / 2);
      add(a, b, x, k * 2 + 2, (l + r) / 2, r);
      datb[k] = max(max(data[k * 2 + 1], datb[k * 2 + 1]),
                    max(data[k * 2 + 2], datb[k * 2 + 2]));
    }
  }
  int getmax(int a, int b) { return getmax(a, b, 0, 0, n); }
  int getmax(int a, int b, int k, int l, int r) {
    if (b <= l || r <= a)
      return -1;
    else if (a <= l && r <= b) {
      return max(data[k], datb[k]);
    } else {
      int res = -1;
      res = max(res, getmax(a, b, k * 2 + 1, l, (l + r) / 2));
      res = max(res, getmax(a, b, k * 2 + 2, (l + r) / 2, r));
      res = max(res, data[k]);
      return res;
    }
  }
} segtree;
int a[100000];
int b[100000];
int x[100000];
int y[100000];
int k[100000];
int main() {
  int n, m;
  while (cin >> n >> m) {
    segtree.ini(n);
    for (int i = 0; i < (int)n; ++i) cin >> a[i];
    for (int i = 0; i < (int)n; ++i) cin >> b[i];
    for (int i = 0; i < (int)m; ++i) {
      int t;
      cin >> t;
      if (t == 1) {
        cin >> x[i] >> y[i] >> k[i];
        x[i]--;
        y[i]--;
        segtree.add(y[i], y[i] + k[i], i);
      } else {
        int r;
        cin >> r;
        r--;
        int res = segtree.getmax(r, r + 1);
        if (res == -1)
          cout << b[r] << endl;
        else {
          cout << a[x[res] + (r - y[res])] << endl;
        }
      }
    }
  }
}
