#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const int MX = 100005;
const int Ed = 1e6;
int N, M, k;
int a[MX], b[MX];
int st[MX * 4];
int E[MX];
void build(int L, int R, int p) {
  if (L == R) {
    st[p] = L;
    return;
  }
  int m = (L + R) >> 1;
  build(L, m, p << 1);
  build(m + 1, R, p << 1 | 1);
  st[p] = 0;
}
void up(int L, int R, int p, int i, int j, int val) {
  if (L > R || L > j || R < i) return;
  int m = (L + R) >> 1;
  if (L >= i && R <= j) {
    st[p] = val + L - i;
    if (L != R) {
      st[p << 1] = st[p];
      st[p << 1 | 1] = st[p] + m - L + 1;
      st[p] = 0;
      if (L == m) E[m]++;
      if (R == m + 1) E[m + 1]++;
    } else
      E[L]++;
    return;
  }
  if (st[p]) {
    st[p << 1] = st[p];
    st[p << 1 | 1] = st[p] + m - L + 1;
    st[p] = 0;
    if (L == m) E[m]++;
    if (R == m + 1) E[m + 1]++;
  }
  up(L, m, p << 1, i, j, val);
  up(m + 1, R, p << 1 | 1, i, j, val);
}
int query(int L, int R, int p, int i, int j) {
  if (L > R || L > j || R < i) return 0;
  if (L >= i && R <= j) {
    return st[p];
  }
  int m = (L + R) >> 1;
  if (st[p]) {
    st[p << 1] = st[p];
    st[p << 1 | 1] = st[p] + m - L + 1;
    st[p] = 0;
    if (L == m) E[m]++;
    if (R == m + 1) E[m + 1]++;
  }
  return query(L, m, p << 1, i, j) + query(m + 1, R, p << 1 | 1, i, j);
}
int main() {
  scanf("%d%d", &N, &M);
  for (int i = 1; i <= N; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= N; i++) scanf("%d", &b[i]);
  vector<int> an;
  build(1, N, 1);
  while (M--) {
    int t;
    scanf("%d", &t);
    if (t == 2) {
      int x;
      scanf("%d", &x);
      int c = query(1, N, 1, x, x);
      if (E[x] == 0)
        an.push_back(b[x]);
      else {
        an.push_back(a[c]);
      }
    } else {
      int x, y, k;
      scanf("%d%d%d", &x, &y, &k);
      up(1, N, 1, y, y + k - 1, x);
    }
  }
  for (int i = 0; i < an.size(); i++) cout << an[i] << "\n";
  return 0;
}
