#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, m;
int a[N], b[N];
int opt, x, y, k;
int data[N << 2];
inline int read() {
  int a = 0;
  int f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) a = a * 10 + (ch ^ 48), ch = getchar();
  return a * f;
}
inline void push_down(int p, int l, int r) {
  if (data[p]) {
    int mid = (l + r) >> 1;
    data[p << 1] = data[p], data[p << 1 | 1] = (mid + 1 - l) + data[p];
    data[p] = 0;
  }
}
inline void update(int p, int l, int r, int fl, int fr) {
  if (fl <= l && r <= fr) {
    data[p] = x + l - fl;
    return;
  }
  push_down(p, l, r);
  int mid = (l + r) >> 1;
  if (fl <= mid) update(p << 1, l, mid, fl, fr);
  if (fr > mid) update(p << 1 | 1, mid + 1, r, fl, fr);
}
inline int query(int p, int l, int r, int pos) {
  if (l == r) {
    if (!data[p]) return b[pos];
    return a[data[p]];
  }
  push_down(p, l, r);
  int mid = (l + r) >> 1;
  if (pos <= mid)
    return query(p << 1, l, mid, pos);
  else
    query(p << 1 | 1, mid + 1, r, pos);
}
inline void write(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10);
  putchar(x % 10 + 48);
}
int main() {
  n = read(), m = read();
  for (int i = 1; i <= n; ++i) a[i] = read();
  for (int i = 1; i <= n; ++i) b[i] = read();
  while (m--) {
    opt = read();
    if (opt == 1) {
      x = read(), y = read();
      update(1, 1, n, y, y + read() - 1);
    } else {
      write(query(1, 1, n, read())), putchar('\n');
    }
  }
  return 0;
}
