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:
/*
???????????????????
DP??��?????????????
??????????????????
?????��????????????
??????????????????
????????????????????
?????????????????????
ll?? int????????????
 dp ????????????????
???????��??????????
?????????????????????
???????��??????????
??��???��???????????
?????????????????
???????????????????
???????????????????
?????????????????????
????????��??????????
?????????????????
*/
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define int long long
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.end()
#define MP make_pair
#define PB emplace_back
#define PF emplace_front
#define FILL(a,b) memset(a,b,sizeof(a))
#define lwb lower_bound
#define upb upper_bound
using namespace std;
int to[200005],a[200005],in[200005],cnt[200005],p[200005];
int len;
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,m;
	cin>>n>>m;
	len=sqrt(n);
	FOR(i,1,n){
		if(i>1)cin>>a[i];
		in[i]=(i-1)/len+1;
	}
	to[1]=1;
	FOR(i,2,n){
		int t=a[i];
		if(in[t]<in[i])to[i]=i;else to[i]=to[t];
	}
	FOR(i,1,m){
		int x;
		cin>>x;
		if(x==1){
			int l,r,x;
			cin>>l>>r>>x;
			if(in[l]==in[r]){
				FOR(j,(in[l]-1)*len+1,in[r]*len){
					if(j>=l&&j<=r)a[j]=max(1ll,a[j]-x);
					int t=max(1ll,a[j]-p[in[j]]);
					if(in[t]<in[j])to[j]=j;else to[j]=to[t];
				}
			}else{
				FOR(j,(in[l]-1)*len+1,in[l]*len){
					if(j>=l)a[j]=max(1ll,a[j]-x);
					int t=max(1ll,a[j]-p[in[j]]);
					if(in[t]<in[j])to[j]=j;else to[j]=to[t];
				}
				FOR(j,in[l]+1,in[r]-1){
					if(cnt[j]<len){
						cnt[j]++;
						FOR(k,(j-1)*len+1,j*len){
							a[k]=max(1ll,a[k]-x);
							int t=max(1ll,a[k]-p[in[k]]);
							if(in[t]<in[k])to[k]=k;else to[k]=to[t];
						}
					}else{
						p[j]+=x;
					}
				}
				FOR(j,(in[r]-1)*len+1,in[r]*len){
					if(j<=r)a[j]=max(1ll,a[j]-x);
					int t=max(1ll,a[j]-p[in[j]]);
					if(in[t]<in[j])to[j]=j;else to[j]=to[t];
				}
			}
		}else{
			int x,y;
//			if(n<=1000)FOR(j,1,n){
//					int t=max(1,a[j]-p[in[j]]);
//					if(in[t]<in[j])to[j]=j;else to[j]=to[t];
//			}
			cin>>x>>y;
			while(x!=y){
				if(x<y)swap(x,y);
				if(to[x]==to[y]){
					while(x!=y){
						if(x<y)swap(x,y);
						x=max(1ll,a[x]-p[in[x]]);
					}
					break;
				}
				if(x!=to[x])x=to[x];else x=max(1ll,a[x]-p[in[x]]);
			}
			cout<<x<<'\n';
		}
	}
	RE 0;
}