#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
int x[111111 * 4];
int y[111111 * 4];
int a[111111];
int b[111111];
void push(int v) {
  if (!x[v]) return;
  x[v + v] = x[v];
  y[v + v] = y[v];
  x[v + v + 1] = x[v];
  y[v + v + 1] = y[v];
  x[v] = 0;
  y[v] = 0;
}
void upd(int v, int tl, int tr, int l, int r, int _x, int _y) {
  if (l > r) return;
  if (tl == l && tr == r) {
    x[v] = _x;
    y[v] = _y;
    return;
  }
  push(v);
  int tm = (tl + tr) / 2;
  upd(v + v, tl, tm, l, min(r, tm), _x, _y);
  upd(v + v + 1, tm + 1, tr, max(tm + 1, l), r, _x, _y);
}
int get(int v, int tl, int tr, int k) {
  if (tl == tr) {
    if (x[v]) {
      return a[x[v] + (k - y[v])];
    } else
      return b[k];
  }
  push(v);
  int tm = (tl + tr) / 2;
  if (k <= tm)
    return get(v + v, tl, tm, k);
  else
    return get(v + v + 1, tm + 1, tr, k);
}
int n, m;
int main() {
  int i, j, k;
  cin >> n >> m;
  for (i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  for (i = 1; i <= n; ++i) {
    cin >> b[i];
  }
  for (i = 1; i <= m; ++i) {
    int id;
    cin >> id;
    if (id == 1) {
      int x, y, k;
      cin >> x >> y >> k;
      upd(1, 1, n, y, y + k - 1, x, y);
    } else {
      int x;
      cin >> x;
      cout << get(1, 1, n, x) << endl;
    }
  }
  return 0;
}
