#include <bits/stdc++.h>
using namespace std;
const long long int inf = 1e9;
const long long int N = 1000005;
long long int power(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int st[4 * N], lazy[4 * N], a[N], b[N], x[N], y[N], k[N];
void update(long long int v, long long int l, long long int r, long long int L,
            long long int R, long long int ind) {
  if (lazy[v] != -1) {
    if (l != r) {
      lazy[2 * v] = lazy[v];
      lazy[2 * v + 1] = lazy[v];
    }
    st[v] = lazy[v];
    lazy[v] = -1;
  }
  if (l > r || L > r || R < l) {
    return;
  }
  if (L <= l && r <= R) {
    if (l != r) {
      lazy[2 * v] = ind;
      lazy[2 * v + 1] = ind;
    }
    st[v] = ind;
    return;
  }
  long long int mid = (l + r) / 2;
  update(2 * v, l, mid, L, R, ind);
  update(2 * v + 1, mid + 1, r, L, R, ind);
}
long long int query(long long int v, long long int l, long long int r,
                    long long int pos) {
  if (lazy[v] != -1) {
    if (l != r) {
      lazy[2 * v] = lazy[2 * v + 1] = lazy[v];
    }
    st[v] = lazy[v];
    lazy[v] = -1;
  }
  if (l == r) {
    return st[v];
  }
  long long int mid = (l + r) / 2;
  if (pos <= mid) {
    return query(2 * v, l, mid, pos);
  }
  return query(2 * v + 1, mid + 1, r, pos);
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  memset(lazy, -1, sizeof(lazy));
  long long int n, q;
  cin >> n >> q;
  for (long long int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (long long int i = 1; i <= n; i++) {
    cin >> b[i];
  }
  for (long long int i = 1; i <= q; i++) {
    long long int type;
    cin >> type;
    if (type == 1) {
      cin >> x[i] >> y[i] >> k[i];
      update(1, 1, n, y[i], y[i] + k[i] - 1, i);
    } else {
      long long int pos;
      cin >> pos;
      long long int id = query(1, 1, n, pos);
      if (id == 0) {
        cout << b[pos] << "\n";
      } else {
        cout << a[pos - y[id] + x[id]] << "\n";
      }
    }
  }
}
