#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e5 + 7;
const long long mod = 1e9 + 7;
const long long INF = 1e9 + 7;
const long long mlog = 22;
const long long SQ = 400;
long long T[maxn * 4];
long long a[maxn], b[maxn];
long long x[maxn], y[maxn], k[maxn];
void add(long long L, long long R, long long col, long long l, long long r,
         long long id) {
  if (r == R && l == L) {
    T[id] = col;
    return;
  }
  long long mid = (l + r) / 2;
  if (L < mid) add(L, min(mid, R), col, l, mid, 2 * id + 0);
  if (R > mid) add(max(L, mid), R, col, mid, r, 2 * id + 1);
}
long long get(long long idx, long long l, long long r, long long id) {
  if (r - l <= 1) return T[id];
  long long mid = (l + r) / 2;
  if (idx < mid)
    return max(T[id], get(idx, l, mid, 2 * id + 0));
  else
    return max(T[id], get(idx, mid, r, 2 * id + 1));
}
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(), cout.tie();
  long long n, m;
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long i = 1; i <= n; i++) cin >> b[i];
  long long t;
  for (long long i = 1; i <= m; i++) {
    cin >> t;
    if (t == 1) {
      cin >> x[i] >> y[i] >> k[i];
      add(y[i], y[i] + k[i], i, 1, n + 1, 1);
    } else {
      long long index;
      cin >> index;
      long long next = get(index, 1, n + 1, 1);
      if (next == 0)
        cout << b[index] << '\n';
      else
        cout << a[x[next] + index - y[next]] << '\n';
    }
  }
  return 0;
}
