#include <bits/stdc++.h>
using namespace std;
const int maxn = 100100;
int n, nn, q, a[maxn], b[maxn];
pair<int, int> flag[270000];
bool mark[270000];
void add(int seg, int fs, int ls, int f, int l, pair<int, int> X) {
  if (fs == f && ls == l) {
    mark[seg] = true;
    flag[seg] = X;
    return;
  }
  if (mark[seg]) {
    flag[seg * 2] = flag[seg];
    flag[seg * 2 + 1] = flag[seg];
    mark[seg] = false;
    mark[seg * 2] = true;
    mark[seg * 2 + 1] = true;
  }
  int mid = (fs + ls) / 2;
  if (l <= mid)
    add(seg * 2, fs, mid, f, l, X);
  else if (mid < f)
    add(seg * 2 + 1, mid + 1, ls, f, l, X);
  else
    add(seg * 2, fs, mid, f, mid, X),
        add(seg * 2 + 1, mid + 1, ls, mid + 1, l, X);
}
int ans(int ind) {
  int ret = b[ind];
  for (int id = nn + ind - 1; id; id /= 2)
    if (mark[id]) ret = a[flag[id].first - flag[id].second + ind];
  return ret;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> q;
  for (nn = 1; nn < n; nn *= 2)
    ;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> b[i];
  for (int i, j, k, t; q--;) {
    cin >> t;
    if (t == 1) {
      cin >> i >> j >> k;
      add(1, 1, nn, j, j + k - 1, make_pair(i, j));
    } else if (t == 2) {
      cin >> i;
      cout << ans(i) << endl;
    }
  }
  return 0;
}
