#include <bits/stdc++.h>
using namespace std;
template <class T1, class T2>
inline istream& operator>>(istream& fin, pair<T1, T2>& pr) {
  fin >> pr.first >> pr.second;
  return fin;
}
template <class T0, class T1, class T2>
inline istream& operator>>(istream& fin, tuple<T0, T1, T2>& t) {
  fin >> get<0>(t) >> get<1>(t) >> get<2>(t);
  return fin;
}
template <class T>
inline istream& operator>>(istream& fin, vector<T>& a) {
  if (!a.size()) {
    size_t n;
    fin >> n;
    a.resize(n);
  }
  for (auto& u : a) fin >> u;
  return fin;
}
void e292() {
  size_t n, m;
  cin >> n >> m;
  vector<int> a(n), b(n);
  cin >> a >> b;
  map<size_t, size_t> jump;
  const size_t NIL = -1;
  jump[0] = jump[n] = NIL;
  vector<int> soln;
  for (; 0 < m; --m) {
    size_t op;
    cin >> op;
    if (op == 1) {
      size_t i, j, len;
      cin >> i >> j >> len;
      --i;
      --j;
      auto iter = jump.upper_bound(j + len);
      const auto next = iter--;
      const auto val =
          iter->second == NIL ? NIL : iter->second + (j + len - iter->first);
      iter = jump.insert(next, make_pair(j + len, val));
      iter->second = val;
      iter = jump.insert(iter, make_pair(j, i));
      iter->second = i;
      jump.erase(++iter, jump.find(j + len));
    } else {
      size_t i;
      cin >> i;
      auto iter = jump.upper_bound(--i);
      --iter;
      if (iter->second == NIL)
        soln.push_back(b[i]);
      else
        soln.push_back(a[iter->second + (i - iter->first)]);
    }
  }
  copy(begin(soln), end(soln), ostream_iterator<int>(cout, "\n"));
}
int main(const int argc, char* argv[]) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  e292();
  return EXIT_SUCCESS;
}
