#include <bits/stdc++.h>
using namespace std;
long long n, m, a[100005], b[100005], sg[400005], lazy[400005];
vector<vector<pair<long long, long long> > > v(100025);
void update(int p, int l, int r, int i, int j, int val) {
  if (lazy[p] != 0) {
    sg[p] = lazy[p];
    if (l != r) {
      lazy[2 * p] = lazy[p];
      lazy[2 * p + 1] = lazy[p];
    }
    lazy[p] = 0;
  }
  if (l > j || r < i) return;
  if (l >= i && r <= j) {
    sg[p] = val;
    if (l != r) {
      lazy[2 * p + 1] = val;
      lazy[2 * p] = val;
    }
    return;
  }
  update(2 * p, l, (l + r) / 2, i, j, val);
  update(2 * p + 1, (l + r) / 2 + 1, r, i, j, val);
}
long long check(int p, int l, int r, int node) {
  if (l > node || r < node) return 0;
  if (lazy[p] != 0) {
    sg[p] = lazy[p];
    if (l != r) {
      lazy[2 * p] = lazy[p];
      lazy[2 * p + 1] = lazy[p];
    }
    lazy[p] = 0;
  }
  if (l == node && r == node) return sg[p];
  int p1 = check(2 * p, l, (l + r) / 2, node);
  int p2 = check(2 * p + 1, (l + r) / 2 + 1, r, node);
  return p1 + p2;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> b[i];
  while (m--) {
    long long t, x, y, k;
    cin >> t;
    if (t == 1) {
      cin >> x >> y >> k;
      update(1, 1, n, y, y + k - 1, y);
      v[y].push_back({y + k - 1, x});
    } else {
      cin >> x;
      long long r = check(1, 1, n, x);
      if (r == 0) {
        cout << b[x] << endl;
      } else {
        int lo = 0;
        for (int i = v[r].size() - 1; i >= 0; i--) {
          if (v[r][i].first >= x) {
            lo = i;
            break;
          }
        }
        cout << a[v[r][lo].second + x - r] << endl;
      }
    }
  }
  return 0;
}
