#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000 + 100;
int n, m, A[MAXN], B[MAXN];
struct node {
  int begin, end, start, qtime;
  bool isB;
  int mid;
  node *right, *left;
  node(int begin = 0, int end = 0) : begin(begin), end(end) {
    isB = true;
    start = 0;
    qtime = MAXN;
    right = left = NULL;
    mid = (begin + end) / 2;
  }
  void add() {
    if (begin + 1 == end) return;
    left = new node(begin, mid);
    right = new node(mid, end);
    (*left).add();
    (*right).add();
  }
  void get(int i, int y, int k, int q) {
    int j = y + k;
    if (begin + 1 == end) {
      isB = false;
      start = i;
      qtime = q;
      return;
    }
    if (y == begin && j == end) {
      isB = false;
      qtime = q;
      start = i;
      return;
    }
    if (mid <= y) {
      (*right).get(i, y, k, q);
      return;
    }
    if (j <= mid) {
      (*left).get(i, y, k, q);
      return;
    }
    (*left).get(i, y, (mid - y), q);
    (*right).get(i + (mid - y), mid, k - (mid - y), q);
  }
  int find(int ind, int maxx, int ans) {
    if (!isB && maxx < qtime) {
      maxx = qtime;
      ans = A[start + ind - begin];
    }
    if (begin + 1 == end) {
      if (maxx == -1)
        return B[ind];
      else
        return ans;
    }
    if (ind < mid)
      return (*left).find(ind, maxx, ans);
    else
      return (*right).find(ind, maxx, ans);
  }
};
void input() {
  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]);
  node root(0, n);
  root.add();
  for (int i = 0, a, x, y, k; i < m; i++) {
    scanf("%d", &a);
    if (a == 1) {
      scanf("%d%d%d", &x, &y, &k);
      x--;
      y--;
      root.get(x, y, k, i);
    } else {
      scanf("%d", &x);
      x--;
      cout << root.find(x, -1, 0) << endl;
    }
  }
}
int main() {
  input();
  return 0;
}
