#include <bits/stdc++.h>
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
struct Node {
  int x, sz;
  Node *l = nullptr, *r = nullptr;
  Node(int a) {
    x = a;
    sz = 1;
  }
  Node(Node *n) {
    l = n->l;
    r = n->r;
    x = n->x;
    sz = n->sz;
  }
};
Node *root = nullptr;
int gs(Node *n) { return n ? n->sz : 0; }
void upd(Node *n) { n->sz = gs(n->l) + 1 + gs(n->r); }
Node *merge(Node *l, Node *r) {
  if (!l) return r;
  if (!r) return l;
  if (rnd() % (gs(l) + gs(r)) < gs(l)) {
    l->r = merge(l->r, r);
    upd(l);
    return l;
  }
  r->l = merge(l, r->l);
  upd(r);
  return r;
}
pair<Node *, Node *> splitKey(Node *n, int k) {
  if (!n) return {nullptr, nullptr};
  Node *nw = new Node(n);
  if (k < n->x) {
    pair<Node *, Node *> p = splitKey(nw->l, k);
    nw->l = p.second;
    upd(nw);
    p.second = nw;
    return p;
  }
  pair<Node *, Node *> p = splitKey(nw->r, k);
  nw->r = p.first;
  upd(nw);
  p.first = nw;
  return p;
}
pair<Node *, Node *> splitSz(Node *n, int k) {
  if (!n) return {nullptr, nullptr};
  Node *nw = new Node(n);
  if (k < gs(n->l) + 1) {
    pair<Node *, Node *> p = splitSz(nw->l, k);
    nw->l = p.second;
    upd(nw);
    p.second = nw;
    return p;
  }
  pair<Node *, Node *> p = splitSz(nw->r, k - gs(n->l) - 1);
  nw->r = p.first;
  upd(nw);
  p.first = nw;
  return p;
}
void noPersAdd(int x) { root = merge(root, new Node(x)); }
Node *add(int pos, int x, Node *n) {
  pair<Node *, Node *> p = splitSz(n, pos - 1);
  return merge(merge(p.first, new Node(x)), p.second);
}
int get(int pos, Node *n) {
  if (pos == gs(n->l) + 1) return n->x;
  if (pos < gs(n->l) + 1) return get(pos, n->l);
  return get(pos - gs(n->l) - 1, n->r);
}
Node *remKey(int key, Node *n) {
  pair<Node *, Node *> p = splitKey(n, key - 1), p1 = splitKey(p.second, key);
  return merge(p.first, p1.second);
}
Node *ctrlC_ctrlV(int s1, int s2, int d, Node *n) {
  int r1 = s1 + d - 1, r2 = s2 + d - 1;
  pair<Node *, Node *> p = splitSz(n, r1), p1 = splitSz(p.first, s1 - 1);
  pair<Node *, Node *> p2 = splitSz(n, r2), p3 = splitSz(p2.first, s2 - 1);
  return merge(p3.first, merge(p1.second, p2.second));
}
Node *remPos(int pos, Node *n) {
  pair<Node *, Node *> p = splitSz(n, pos - 1), p1 = splitSz(p.second, 1);
  return merge(p.first, p1.second);
}
void print(Node *n) {
  if (!n) return;
  print(n->l);
  cout << n->x << " ";
  print(n->r);
}
void print() {
  print(root);
  cout << endl;
}
int a, z;
vector<int> m, n;
int main() {
  cin.tie(0);
  cout.tie(0);
  cin.sync_with_stdio(0);
  cout.sync_with_stdio(0);
  ;
  cin >> a >> z;
  m = vector<int>(a);
  n = vector<int>(a);
  for (int q = 0; q < a; q++) cin >> m[q], noPersAdd(m[q]);
  for (int q = 0; q < a; q++) cin >> n[q], noPersAdd(n[q]);
  for (; z; z--) {
    int t, x;
    cin >> t >> x;
    if (t == 1) {
      int y, d;
      cin >> y >> d;
      root = ctrlC_ctrlV(x, a + y, d, root);
    } else
      cout << get(a + x, root) << "\n";
  }
}
