#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const double eps = 1e-9;
const int N = 1 << 17;
pair<int, int> t[N * 2];
inline void push(int x) {
  if (x >= N) return;
  if (t[x] == make_pair(-1, -1)) return;
  t[2 * x] = t[x];
  t[2 * x + 1] = t[x];
  t[x] = make_pair(-1, -1);
}
inline void modify(int x, int l, int r, int lq, int rq, pair<int, int> val) {
  if (lq <= l && r <= rq) {
    t[x] = val;
    return;
  }
  if (l >= rq || r <= lq) return;
  push(x);
  int m = (l + r) >> 1;
  modify(2 * x, l, m, lq, rq, val);
  modify(2 * x + 1, m, r, lq, rq, val);
}
int a[N], b[N];
inline int get(int q) {
  int x = q + N;
  pair<int, int> res = t[x];
  while (x > 1) {
    x >>= 1;
    if (t[x] != make_pair(-1, -1)) res = t[x];
  }
  if (res == make_pair(-1, -1))
    return b[q];
  else
    return a[q + res.first - res.second];
}
int main() {
  memset(t, -1, sizeof t);
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; (i) < (n); ++i) scanf("%d", &a[i]);
  for (int i = 0; (i) < (n); ++i) scanf("%d", &b[i]);
  for (int _ = 0; (_) < (m); ++_) {
    int t;
    scanf("%d", &t);
    if (t == 1) {
      int k, x, y;
      scanf("%d%d%d", &x, &y, &k);
      x--, y--;
      modify(1, 0, N, y, y + k, make_pair(x, y));
    } else {
      int x;
      scanf("%d", &x);
      x--;
      printf("%d\n", get(x));
    }
  }
  return 0;
}
