#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int a[N], b[N], seg[4 * N], lazy[4 * N], n, diff[N];
void update(int sq, int eq, int val, int id = 1, int s = 1, int e = n) {
  if (lazy[id] != 0) {
    seg[id] = lazy[id];
    if (s != e) lazy[id * 2] = lazy[id * 2 + 1] = lazy[id];
    lazy[id] = 0;
  }
  if (s > eq || e < sq) return;
  if (s >= sq && e <= eq) {
    seg[id] = val;
    if (s != e) lazy[id * 2] = lazy[id * 2 + 1] = val;
    return;
  }
  int mid = (s + e) / 2;
  update(sq, eq, val, id * 2, s, mid);
  update(sq, eq, val, id * 2 + 1, mid + 1, e);
}
int query(int idx, int id = 1, int s = 1, int e = n) {
  if (lazy[id] != 0) {
    seg[id] = lazy[id];
    if (s != e) lazy[id * 2] = lazy[id * 2 + 1] = lazy[id];
    lazy[id] = 0;
  }
  if (s == e) return seg[id];
  int mid = (s + e) / 2;
  if (idx <= mid)
    return query(idx, id * 2, s, mid);
  else
    return query(idx, id * 2 + 1, mid + 1, e);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> b[i];
  for (int i = 1; i <= m; i++) {
    int t;
    cin >> t;
    if (t == 2) {
      int x;
      cin >> x;
      int cur = query(x);
      if (cur == 0)
        cout << b[x] << "\n";
      else
        cout << a[x + diff[cur]] << "\n";
    } else {
      int x, y, k;
      cin >> x >> y >> k;
      diff[i] = x - y;
      update(y, y + k - 1, i);
    }
  }
  return 0;
}
