#include <bits/stdc++.h>
using namespace std;
vector<int> a;
vector<int> b;
vector<pair<int, int> > st;
vector<bool> lz;
void upd(int strt, int end, int l, int r, pair<int, int> val, int node) {
  if (strt > r || end < l) return;
  if (strt == end) {
    st[node] = val;
    lz[node] = true;
    return;
  }
  if (strt >= l && end <= r) {
    st[node] = val;
    lz[node] = true;
    lz[2 * node + 1] = false;
    lz[2 * node + 2] = false;
    return;
  }
  if (lz[node] == true) {
    st[2 * node + 1] = st[node];
    st[2 * node + 2] = st[node];
    lz[2 * node + 1] = true;
    lz[2 * node + 2] = true;
  }
  lz[node] = false;
  int mid = (strt + end) / 2;
  upd(strt, mid, l, r, val, 2 * node + 1);
  upd(mid + 1, end, l, r, val, 2 * node + 2);
}
int query(int strt, int end, int pos, int node) {
  if (pos < strt || pos > end) return -1;
  if (lz[node]) {
    int aind = st[node].first;
    int bind = st[node].second;
    if (aind == -1 || bind == -1) return b[pos];
    return a[aind + pos - bind];
  }
  int mid = (strt + end) / 2;
  if (pos <= mid)
    return query(strt, mid, pos, 2 * node + 1);
  else
    return query(mid + 1, end, pos, 2 * node + 2);
}
void display(int strt, int end, int node) {
  cout << "[" << strt << ", " << end << "]:";
  cout << lz[node] << ' ' << st[node].first << ' ' << st[node].second;
  cout << '\n';
  if (strt == end) return;
  int mid = (strt + end) / 2;
  display(strt, mid, 2 * node + 1);
  display(mid + 1, end, 2 * node + 2);
}
int main() {
  int n, m, i, t, x, y, l, r, k;
  cin >> n >> m;
  a.resize(n);
  b.resize(n);
  st.resize(4 * n);
  lz.resize(4 * n);
  fill(lz.begin(), lz.end(), true);
  fill(st.begin(), st.end(), make_pair(-1, -1));
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < n; i++) cin >> b[i];
  for (i = 0; i < m; i++) {
    cin >> t;
    if (t == 1) {
      cin >> x >> y >> k;
      x--;
      y--;
      upd(0, n - 1, y, y + k - 1, make_pair(x, y), 0);
      continue;
    }
    cin >> x;
    x--;
    cout << query(0, n - 1, x, 0) << '\n';
  }
  return 0;
}
