#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int inf = 1e9;
const int N = 100005;
struct copy_info {
  int x, y, k;
};
int t[4 * N], a[N], b[N];
vector<copy_info> info;
void push(int v) {
  if (t[v] != -1) {
    t[2 * v + 1] = t[2 * v] = t[v];
    t[v] = -1;
  }
}
void update(int v, int tl, int tr, int l, int r, int color) {
  if (l > r) return;
  if (l == tl && tr == r)
    t[v] = color;
  else {
    push(v);
    int tm = (tl + tr) >> 1;
    update(2 * v, tl, tm, l, min(r, tm), color);
    update(2 * v + 1, tm + 1, tr, max(l, tm + 1), r, color);
  }
}
int get(int v, int tl, int tr, int pos) {
  if (tl == tr) return t[v];
  push(v);
  int tm = (tl + tr) >> 1;
  if (pos <= tm)
    return get(2 * v, tl, tm, pos);
  else
    return get(2 * v + 1, tm + 1, tr, pos);
}
int main() {
  ios_base::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  memset(t, -1, sizeof(t));
  for (int i = 0; i < m; i++) {
    int choise;
    cin >> choise;
    if (choise == 1) {
      int x, y, k;
      cin >> x >> y >> k;
      info.push_back({x, y, k});
      update(1, 0, n - 1, y - 1, y + k - 2, (int)info.size() - 1);
    }
    if (choise == 2) {
      int pos;
      cin >> pos;
      pos--;
      int index = get(1, 0, n - 1, pos);
      if (index == -1)
        cout << b[pos] << endl;
      else {
        cout << a[info[index].x + pos - info[index].y] << endl;
      }
    }
  }
  cout << endl;
  return 0;
}
