#include <bits/stdc++.h>
using namespace std;
vector<int> a, b;
vector<int> overrideIdx;
void push(int node, int l, int r) {
  if (overrideIdx[node] >= 0) {
    overrideIdx[2 * node + 1] = overrideIdx[node];
    overrideIdx[2 * node + 2] = overrideIdx[node] + (r - l) / 2 + 1;
    overrideIdx[node] = -1;
  }
}
int get(int node, int l, int r, int idx) {
  if (overrideIdx[node] >= 0) {
    idx = overrideIdx[node] + (idx - l);
    return a[idx];
  }
  if (l == r) return b[idx];
  int m = l + (r - l) / 2;
  if (idx > m)
    return get(2 * node + 2, m + 1, r, idx);
  else
    return get(2 * node + 1, l, m, idx);
}
void Set(int node, int l, int r, int idx, int s, int aIdx) {
  if (idx > r || idx + s - 1 < l) return;
  if (l >= idx && r <= idx + s - 1) {
    overrideIdx[node] = aIdx + l - idx;
    return;
  }
  push(node, l, r);
  int m = l + (r - l) / 2;
  Set(2 * node + 1, l, m, idx, s, aIdx);
  Set(2 * node + 2, m + 1, r, idx, s, aIdx);
}
int main() {
  int n, m;
  cin >> n >> m;
  a.resize(n);
  b.resize(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) cin >> b[i];
  int N = 1;
  while (N <= n) N *= 2;
  N *= 2;
  overrideIdx.resize(N, -1);
  while (m--) {
    int t;
    cin >> t;
    if (t == 1) {
      int x, y, k;
      cin >> x >> y >> k;
      --x;
      --y;
      Set(0, 0, n - 1, y, k, x);
    } else {
      int x;
      cin >> x;
      --x;
      cout << get(0, 0, n - 1, x) << "\n";
    }
  }
  return 0;
}
