return tmp;
}
pushdown(p);
if(x>mid)
return query(rs,x);
return query(ls,x);
}
int main()
{
freopen("dd.txt","r",stdin);
int n,q,i;
scanf("%d%d",&n,&q);
for(i=1;i<=n;i++)
scanf("%d",&a[i]);
for(i=1;i<=n;i++)
scanf("%d",&b[i]);
build(1,1,n);
while(q--)
{
scanf("%d",&t);
if(t==1)
{
scanf("%d%d%d",&x,&y,&z);
change(1,y,y+z-1,x,y);
}
else
{
scanf("%d",&x);
node tmp=query(1,x);
if(tmp.stb==0)
printf("%d\n",b[x]);
else
printf("%d\n",a[x-tmp.stb+tmp.sta]);
}
}
return 0;
}