Problem: Yuezheng Ling gives Luo Tianyi a tree which has n nodes, rooted at 1. 

Luo Tianyi will tell you that the parent of the i-th node is a_i (1 ≤ a_i<i for 2 ≤ i ≤ n), and she will ask you to perform q queries of 2 types:

  1. She'll give you three integers l, r and x (2 ≤ l ≤ r ≤ n, 1 ≤ x ≤ 10^5). You need to replace a_i with max(a_i-x,1) for all i with l ≤ i ≤ r.
  2. She'll give you two integers u, v (1 ≤ u, v ≤ n). You need to find the [LCA](https://en.wikipedia.org/wiki/Lowest_common_ancestor) of nodes u and v (their lowest common ancestor).

Input

The first line contains two integers n and q (2≤ n,q ≤ 10^5) — the number of nodes and the number of queries, respectively.

The second line contains n-1 integers a_2, a_3,..., a_n (1 ≤ a_i < i), where a_i is the parent of the node i.

Next q lines contain queries. For each query, the first integer of each line is t (t = 1 or 2) — the type of the query. 

If t = 1, this represents the query of the first type. Then, three integers will follow: l, r, x (2 ≤ l ≤ r ≤ n, 1 ≤ x ≤ 10^5), meaning that you have to replace a_i with max(a_i-x,1) for all i with l ≤ i ≤ r.

If t = 2, this represents the query of the second type. Then, two integers will follow: u and v (1 ≤ u, v ≤ n), and you have to find the LCA of u and v. 

It's guaranteed that there is at least one query of the second type.

Output

For each query of the second type output answer on a new line.

Example

Input


6 4
1 2 3 3 4
2 3 4
1 2 3 1
2 5 6
2 2 3


Output


3
3
1

Note

The tree in example is shown below.

<image>

After the query of the first type, the tree changes and is looking as shown below.

<image>

Solution (in CPP):

Solution:
#include<bits/stdc++.h>
#define bx bel[x]
#define by bel[y]
using namespace std;
inline int read() {
	int __x=0,__f=1;
	char __c=getchar();
	while(__c<'0'||__c>'9') {
		if(__c=='-')__f=-1;
		__c=getchar();
	}
	while(__c>='0'&&__c<='9') {
		__x=__x*10+__c-'0';
		__c=getchar();
	}
	return __x*__f;
}
const int maxn=1e5+5,maxm=1000;
int f[maxn],l[maxm],r[maxm],bel[maxn],n,m,sqrtn,sn,dlt[maxm],a[maxn],dl[maxm];
int getf(int x) {
	return f[x]==x?x:f[x]=getf(f[x]);
}
void merge(int x,int y) {
	x=getf(x),y=getf(y);
	if(x==y)return;
	f[y]=x;
}
void reset(int w) {
	for(register int i=l[w]; i<=r[w]; i++)f[i]=i;
	for(register int i=l[w]; i<=r[w]; i++)if(bel[a[i]]==w)merge(a[i],i);
}
void del(int lx,int ry,int k) {
	int x=bel[lx],y=bel[ry];
	if(x==y) {
		for(register int i=lx; i<=ry; i++)a[i]=max(a[i]-k,1);
		if(dl[x]<r[x]-l[x]+1)reset(x);
		return;
	}
	for(register int i=lx; i<=r[x]; i++)a[i]=max(a[i]-k,1);
	if(dl[x]<r[x]-l[x]+1)reset(x);
	for(register int i=l[y]; i<=ry; i++)a[i]=max(a[i]-k,1);
	if(dl[y]<r[y]-l[y]+1)reset(y);
	for(register int i=x+1; i<=y-1; i++) {
		if(dl[i]<r[i]-l[i]+1) {
			for(register int j=l[i]; j<=r[i]; j++)a[j]=max(a[j]-k,1);
			reset(i),dl[i]+=k;
		}
		else if(dlt[i]<r[i])dlt[i]+=k;
	}
}
int ask(int x,int y) {
	while(x^1&&y^1) {
//		cout<<x<<' '<<y<<' '<<bx<<' '<<by<<'*'<<endl;
		if(bx!=by) {
			if(x>y)swap(x,y);
			if(dl[by]>=r[by]-l[by]+1)y=max(1,a[y]-dlt[by]);
			else y=max(1,a[getf(y)]-dlt[by]);
			continue;
		}
		if(dl[bx]>=r[bx]-l[bx]+1) {
			if(x==y)return x;
			x=max(1,a[x]-dlt[bx]),y=max(1,a[y]-dlt[by]);
		} else {
			if(getf(x)==getf(y)) {
				while(x!=y) {
					if(x>y)swap(x,y);
					y=max(1,a[y]-dlt[by]);
				}
				return x;
			}
			x=max(1,a[getf(x)]-dlt[bx]),y=max(1,a[getf(y)]-dlt[by]);
		}
	}
	return 1;
}
int main() {
	int op,x,y,z;
	n=read(),m=read();
	sqrtn=159,sn=n/sqrtn+(n%sqrtn!=0),bel[1]=1;
	for(register int i=2; i<=n; i++)bel[i]=(i-1)/sqrtn+1,a[i]=read();
	for(register int i=1; i<=sn; i++)l[i]=(i-1)*sqrtn+1,r[i]=min(i*sqrtn,n),reset(i);
	while(m--) {
//		puts("------");
		op=read(),x=read(),y=read();
		if(op==1)z=read(),del(x,y,z);
		else printf("%d\n",ask(x,y));
//		lst=0;
//		for(register int i=1;i<=n;i++)printf("%d%c",a[i]," \n"[i==n]);
//		for(register int i=1;i<=sn;i++)printf("%d%c",dlt[i]," \n"[i==sn]);
	}
	return 0;
}