#include <bits/stdc++.h>
int B = 400;
using namespace std;
const long long inf = 1e17;
int MOD = 998244353;
const int mxn = 100010;
int dx[] = {0, 1, 0, -1, 1, -1, 1, -1};
int dy[] = {1, 0, -1, 0, -1, 1, 1, -1};
int n;
int tree[4 * mxn];
int a[mxn], b[mxn], t;
pair<int, int> q[mxn];
void upd(int node, int l, int r, int upd_l, int upd_r, int val) {
  if (l > upd_r || r < upd_l) return;
  if (l >= upd_l && r <= upd_r) {
    tree[node] = val;
    return;
  }
  int mid = (l + r) / 2;
  upd(2 * node, l, mid, upd_l, upd_r, val);
  upd(2 * node + 1, mid + 1, r, upd_l, upd_r, val);
}
int qry(int node, int l, int r, int ql) {
  if (l == r) return tree[node];
  int mid = (l + r) / 2;
  if (ql <= mid)
    return max(tree[node], qry(node * 2, l, mid, ql));
  else
    return max(tree[node], qry(node * 2 + 1, mid + 1, r, ql));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> t;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> b[i];
  for (int i = 1; i <= t; i++) {
    int tp;
    cin >> tp;
    if (tp == 1) {
      int x, y, k;
      cin >> x >> y >> k;
      q[i] = {x, y};
      upd(1, 1, n, y, y + k - 1, i);
    } else {
      int x;
      cin >> x;
      int res = qry(1, 1, n, x);
      if (!res)
        cout << b[x] << endl;
      else
        cout << a[-q[res].second + q[res].first + x] << endl;
    }
  }
}
