import std.algorithm;
import std.container;
import std.exception;
import std.format;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

immutable int MED_L = 1 << 17;
immutable int MAX_L = MED_L << 1;

void main ()
{
	int n, m;
	while (scanf (" %d %d", &n, &m) > 0)
	{
		auto a = new int [n];
		foreach (i; 0..n)
		{
			scanf (" %d", &a[i]);
		}
		auto b = new int [n];
		foreach (i; 0..n)
		{
			scanf (" %d", &b[i]);
		}

		auto x = new int [m];
		auto y = new int [m];
		auto z = new int [m];
		auto t = new int [MAX_L];
		t[] = -1;

		void mark (int q, int lo, int hi)
		{
			lo += MED_L;
			hi += MED_L;
			while (lo <= hi)
			{
				if (lo & 1)
				{
					debug {writefln ("t[%s] = %s", lo, q);}
					t[lo] = q;
					lo++;
				}
				if (!(hi & 1))
				{
					debug {writefln ("t[%s] = %s", hi, q);}
					t[hi] = q;
					hi--;
				}
				lo >>= 1;
				hi >>= 1;
			}
		}

		int value (int p)
		{
			int res = b[p];
			int q = -1;
			for (int s = p + MED_L; s > 0; s >>= 1)
			{
				q = max (q, t[s]);
			}
			if (q != -1)
			{
				debug {writefln ("q = %s, p = %s", q, p);}
				debug {writefln ("index = %s + %s - %s = %s",
				                 x[q], p, y[q],
				                 x[q] + p - y[q]);}
				res = a[x[q] + p - y[q]];
			}
			return res;
		}

		foreach (j; 0..m)
		{
			int k;
			scanf (" %d", &k);
			if (k == 1)
			{
				scanf (" %d %d %d", &x[j], &y[j], &z[j]);
				x[j]--;
				y[j]--;
				mark (j, y[j], y[j] + z[j] - 1);
			}
			else if (k == 2)
			{
				int p;
				scanf (" %d", &p);
				debug {writefln ("p = %d", p);}
				p--;
				int v = value (p);
				printf ("%d\n", v);
			}
			else
			{
				assert (false);
			}
		}
	}
}
