#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:0x04000000")
using namespace std;
struct SegmentTree {
  int l;
  int r;
  int col;
  SegmentTree *l_son;
  SegmentTree *r_son;
  SegmentTree(int l, int r) : l(l), r(r), col(-1), l_son(0), r_son(0) {
    if (l != r) {
      l_son = new SegmentTree(l, (l + r) / 2);
      r_son = new SegmentTree((l + r) / 2 + 1, r);
    }
  }
  void Push() {
    if (col != -1) {
      l_son->col = r_son->col = col;
      col = -1;
    }
  }
  void Col(int a, int b, int new_col) {
    if (a > r || b < l) {
      return;
    }
    if (a <= l && b >= r) {
      col = new_col;
      return;
    }
    Push();
    l_son->Col(a, b, new_col);
    r_son->Col(a, b, new_col);
  }
  int Val(int pos) {
    if (col != -1 || l == r) {
      return col;
    }
    return pos <= (l + r) / 2 ? l_son->Val(pos) : r_son->Val(pos);
  }
};
struct Query {
  int t;
  int x;
  int y;
  int k;
  Query(int t = 0, int x = 0, int y = 0, int k = 0) : t(t), x(x), y(y), k(k) {}
};
const int MAX_N = 100005;
const int MAX_M = 100005;
Query queries[MAX_M];
int a[MAX_N];
int b[MAX_N];
int main() {
  int n;
  int m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  SegmentTree *cols = new SegmentTree(0, n - 1);
  for (int i = 0; i < m; i++) {
    int t;
    cin >> t;
    if (t == 1) {
      int x;
      int y;
      int k;
      cin >> x >> y >> k;
      x--;
      y--;
      queries[i] = Query(t, x, y, k);
      cols->Col(y, y + k - 1, i);
    } else {
      int x;
      cin >> x;
      x--;
      queries[i] = Query(t, x);
      int col = cols->Val(x);
      if (col == -1) {
        cout << b[x] << "\n";
      } else {
        int diff = x - queries[col].y;
        cout << a[queries[col].x + diff] << "\n";
      }
    }
  }
}
