#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> t, a, b;
vector<pair<int, int>> p;
void push(int v) {
  if (t[v] != -1) {
    t[v * 2] = t[v * 2 + 1] = t[v];
    t[v] = -1;
  }
}
void update(int v, int l, int r, int vl, int vr, int color) {
  if (vl > vr) return;
  if (l == vl && r == vr)
    t[v] = color;
  else {
    push(v);
    int m = (l + r) / 2;
    update(v * 2, l, m, vl, min(vr, m), color);
    update(v * 2 + 1, m + 1, r, max(vl, m + 1), vr, color);
  }
}
int get(int v, int l, int r, int pos) {
  if (l == r) return t[v];
  push(v);
  int m = (l + r) / 2;
  if (m >= pos)
    return get(v * 2, l, m, pos);
  else
    return get(v * 2 + 1, m + 1, r, pos);
}
int main() {
  cin >> n >> m;
  a.resize(n);
  b.resize(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) cin >> b[i];
  int bin = 1;
  while (bin < n) bin *= 2;
  n = bin;
  t.assign(n * 2, -1);
  for (int i = 0; i < m; ++i) {
    int type;
    cin >> type;
    if (type == 1) {
      int l, q, k;
      cin >> l >> q >> k;
      update(1, 0, n - 1, q - 1, q + k - 2, p.size());
      p.push_back({l, q});
    } else {
      int x, y = -1;
      cin >> x;
      y = get(1, 0, n - 1, x - 1);
      if (y == -1)
        cout << b[x - 1] << "\n";
      else
        cout << a[p[y].first + x - p[y].second - 1] << "\n";
    }
  }
  return 0;
}
