#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)1e6 + 100;
const int mod = (int)1e9 + 7;
inline long long getint() {
  char _c = getchar();
  long long _x = 0, _s = 1;
  while (_c <= 32) _c = getchar();
  if (_c == '-') _s = -1, _c = getchar();
  while ('0' <= _c && _c <= '9') _x = _x * 10 + _c - '0', _c = getchar();
  return _x * _s;
}
int t[maxn * 4], n, m, lz[4 * maxn], x[maxn], y[maxn], k[maxn], a[maxn],
    b[maxn];
inline void push(int v, int tl, int tr) {
  if (lz[v]) {
    lz[v + v] = lz[v + v + 1] = lz[v];
    t[v] = lz[v];
    lz[v] = 0;
  }
}
void upd(int l, int r, int val, int v = 1, int tl = 1, int tr = n) {
  push(v, tl, tr);
  if (l > r || tl > r || tr < l) return;
  if (l <= tl && tr <= r) {
    lz[v] = val;
    push(v, tl, tr);
    return;
  }
  int tm = (tl + tr) >> 1;
  upd(l, r, val, v + v, tl, tm);
  upd(l, r, val, v + v + 1, tm + 1, tr);
}
int get(int pos, int v = 1, int tl = 1, int tr = n) {
  push(v, tl, tr);
  if (tl == tr) return t[v];
  int tm = (tl + tr) >> 1;
  if (pos <= tm)
    return get(pos, v + v, tl, tm);
  else
    return get(pos, v + v + 1, tm + 1, tr);
}
int main() {
  n = getint(), m = getint();
  for (int i = 1; i <= n; i++) a[i] = getint();
  for (int i = 1; i <= n; i++) b[i] = getint();
  for (int i = 1; i <= m; i++) {
    int t;
    t = getint();
    if (t == 1) {
      x[i] = getint(), y[i] = getint(), k[i] = getint();
      upd(y[i], y[i] + k[i] - 1, i);
    } else {
      x[i] = getint();
      int val = get(x[i]);
      if (!val)
        cout << b[x[i]] << endl;
      else
        cout << a[x[i] - y[val] + x[val]] << endl;
    }
  }
}
