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 ll int
#define f first
#define s second
#define pb push_back
using namespace std;
ll n,q,p[100005],a[100005],raod[100005];
ll k[100005],was[100005],da[100005],uk[100005],sq,zog;
ll f[100005];
ll saw(ll x){
    return x / sq * sq;
}
void upd(ll l,ll x){
    a[l] = a[l] - (da[l / sq] - uk[l]) - x;
    if(a[l] < 1)a[l] = 1;
    zog++;
    if(a[l] < saw(l)){
        f[l] = l;
    }
    if(a[l] >= saw(l)){
        f[l] = f[a[l]];
    }
    uk[l] = da[l / sq];
}
ll gan(ll l){
    a[l] = max(a[l] - (da[l / sq] - uk[l]) , 1);
    uk[l] = da[l / sq];
    return a[l];
}
int main(){
    ios::sync_with_stdio(false);
    cin >> n >> q;
    sq = sqrt(n);
    for(int i=2; i<=n; i++){
        cin >> a[i];
    }
    
    for(int i=1; i<=n; i++){
        int x = i,las = i;
        while(x >= saw(i) && x){
            las = x;
            x = a[x];
        }
        f[i] = las;
    }
    vector<int>pi,me,X,Y;
    
    while(q--){
        int typ;
        cin >> typ;
        if(typ == 1){
            ll l,r,x;
            cin >> l >> r >> x;
            ll ki = 0;
            while((l % sq) != 0 && l <= r){
                upd(l , x);
                ki = 1;
                l++;
            }
            if(ki){
                for(int i=(l - 1) / sq * sq; i < min((l-1 + sq) / sq * sq,n); i++){
                    a[i] = gan(i);
                    if(a[i] >= saw(i))
                        f[i] = f[a[i]];
                    else f[i] = i;
                }
            }
            ki = 0;
            ll W = max((r / sq) * sq,l);
            while(W <= r){
                ki = 1;
                upd(W , x);
                W++;
            }
            if(ki){
                for(int i=r / sq * sq; i < min((r + sq) / sq * sq,n); i++){
                    a[i] = gan(i);
                    if(a[i] >= saw(i))
                        f[i] = f[a[i]];
                    else f[i] = i;
                }
            }
            r = (r / sq) * sq - 1;
            if(r >= l){
                for(int bas=l/sq; bas <= r/sq; bas++){
                    ll st = bas * sq;
                    da[bas] += x;
                    raod[bas]++;
                    if(raod[bas] > sq+5)continue;
                    while(st < (bas + 1) * sq){
                        upd(st , 0);
                        st++;
                    }
                }
            }
        }
        else {
            ll x,y;
            cin >> x >> y;
            while(x != y){
                if(x < y)swap(x , y);
                if(f[x] >= y){
                    x = f[x];
                    if(x == y)break;
                    x = gan(x);
                    continue;
                }
                if(f[x] != f[y]){
                    x = gan(f[x]);
                    y = gan(f[y]);
                    continue;
                }
                while(x != y){
                    x = gan(x);
                    if(y > x)swap(x , y);
                }
            }
            cout << x << '\n';
        }
    }
    
    
    
    return 0;
}