#include <bits/stdc++.h>
using namespace std;
int a[100 * 1000];
int b[100 * 1000];
map<int, pair<bool, int> > pos;
void make_copy(int x, int y, int k) {
  map<int, pair<bool, int> >::iterator start = pos.lower_bound(y);
  map<int, pair<bool, int> >::iterator finish = --pos.upper_bound(y + k - 1);
  pair<bool, int> tmp;
  int tmp2;
  bool flag = false;
  if (finish != pos.end()) {
    tmp = finish->second;
    tmp2 = finish->first;
    flag = true;
  }
  pos.erase(start, ++finish);
  if (flag) {
    if (pos.count(y + k) == 0) {
      pos[y + k] = make_pair(tmp.first, tmp.second + (y + k - tmp2));
    }
  }
  pos[y] = make_pair(true, x);
}
int query(int x) {
  map<int, pair<bool, int> >::iterator it = --pos.upper_bound(x);
  if (it->second.first) {
    return a[x - it->first + it->second.second];
  }
  return b[x - it->first + it->second.second];
}
int main(void) {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", &b[i]);
  }
  pos[0] = make_pair(false, 0);
  for (int i = 0; i < m; ++i) {
    int t;
    scanf("%d", &t);
    if (t == 1) {
      int x, y, k;
      scanf("%d%d%d", &x, &y, &k);
      make_copy(x - 1, y - 1, k);
    } else {
      int x;
      scanf("%d", &x);
      printf("%d\n", query(x - 1));
    }
  }
  return 0;
}
