#include <bits/stdc++.h>
using namespace std;
const int size = 100050;
bool push[size << 2];
int val[size << 2];
int aa[size], bb[size], qa[size], qb[size], len;
void update(int x, int l, int r, int ll, int rr, int t) {
  if (ll <= l && r <= rr) {
    push[x] = true;
    val[x] = t;
    return;
  }
  if (push[x]) {
    push[x << 1] = push[(x << 1) + 1] = true;
    val[x << 1] = val[(x << 1) + 1] = val[x];
    push[x] = false;
  }
  int mid = (l + r) >> 1;
  if (ll <= mid) update(x << 1, l, mid, ll, rr, t);
  if (mid < rr) update((x << 1) + 1, mid + 1, r, ll, rr, t);
}
int query(int x, int l, int r, int pos) {
  if (l == r) return val[x];
  if (push[x]) {
    push[x << 1] = push[(x << 1) + 1] = true;
    val[x << 1] = val[(x << 1) + 1] = val[x];
    push[x] = false;
  }
  int mid = (l + r) >> 1;
  if (pos <= mid) return query(x << 1, l, mid, pos);
  return query((x << 1) + 1, mid + 1, r, pos);
}
int main() {
  int i, n, m, p;
  scanf("%d %d", &n, &m);
  for (i = 1; i <= n; ++i) scanf("%d", aa + i);
  for (i = 1; i <= n; ++i) scanf("%d", bb + i);
  push[1] = true;
  val[1] = 0;
  for (i = 1; i <= m; ++i) {
    scanf("%d", &p);
    if (p == 1) {
      scanf("%d %d %d", qa + i, qb + i, &len);
      update(1, 1, n, qb[i], qb[i] + len - 1, i);
    } else {
      int x;
      scanf("%d", &x);
      int u = query(1, 1, n, x);
      if (u == 0)
        printf("%d\n", bb[x]);
      else
        printf("%d\n", aa[x - qb[u] + qa[u]]);
    }
  }
  return 0;
}
