#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  while (true) {
    if (a > b) swap(a, b);
    if (a == 0) return b;
    long long p = b % a, q = a;
    a = p;
    b = q;
  }
}
long long powerMod(long long x, long long y) {
  long long res = 1;
  x %= 1000000007;
  while (y > 0) {
    if (y & 1) res = (res * x) % 1000000007;
    y = y >> 1;
    x = (x * x) % 1000000007;
  }
  return res % 1000000007;
}
string binary(long long s) {
  string res = "";
  while (s != 0) {
    res += (char)('0' + s % 2);
    s /= 2;
  }
  reverse(res.begin(), res.end());
  return res;
}
struct data {
  int ai, bi;
  data() { ai = bi = -1; }
};
vector<data> tree, lazy;
vector<int> a;
void build(int start, int end, int node) {
  if (start > end) return;
  if (start == end) {
    data d;
    tree[node] = d;
    return;
  }
  int mid = start + (end - start) / 2;
  build(start, mid, 2 * node + 1);
  build(mid + 1, end, 2 * node + 2);
}
void clr(int node) {
  if (lazy[node].ai != -1) {
    tree[node] = lazy[node];
    if (2 * node + 2 < lazy.size()) {
      lazy[2 * node + 1] = lazy[2 * node + 2] = lazy[node];
    }
    lazy[node].ai = lazy[node].bi = -1;
  }
}
void updr(int start, int end, int node, int left, int right,
          pair<int, int> val) {
  if (start > end || start > right || end < left) {
    return;
  }
  clr(node);
  if (start >= left && end <= right) {
    tree[node].ai = val.first;
    tree[node].bi = val.second;
    if (2 * node + 2 < lazy.size()) {
      lazy[2 * node + 1] = lazy[2 * node + 2] = tree[node];
    }
    return;
  }
  int mid = start + (end - start) / 2;
  updr(start, mid, 2 * node + 1, left, right, val);
  updr(mid + 1, end, 2 * node + 2, left, right, val);
}
data query(int start, int end, int node, int left, int right) {
  data d;
  if (start > end || start > right || end < left) return d;
  clr(node);
  if (start >= left && end <= right) return tree[node];
  int mid = start + (end - start) / 2;
  if (left >= start && left <= mid)
    return query(start, mid, 2 * node + 1, left, right);
  else
    return query(mid + 1, end, 2 * node + 2, left, right);
}
void solve() {
  int n, m, i, j, k, l, p;
  cin >> n >> m;
  tree.resize(4 * n + 5);
  lazy.resize(4 * n + 5);
  vector<int> a(n), b(n);
  for (auto &i : a) cin >> i;
  for (auto &i : b) cin >> i;
  while (m--) {
    cin >> i;
    if (i == 1) {
      cin >> j >> k >> l;
      updr(0, n - 1, 0, k - 1, k - 1 + l - 1, {j - 1, k - 1});
    } else {
      cin >> j;
      data d = query(0, n - 1, 0, j - 1, j - 1);
      if (d.bi == -1)
        cout << b[j - 1] << "\n";
      else {
        k = j - 1 - d.bi;
        cout << a[d.ai + k] << "\n";
      }
    }
  }
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
