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:
/*
    author: DPair
    language: C++11

    hitokoto:
    聚集的群星化为穿破虚空的利箭，成为光明闪耀的道路吧！
*/
#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native")
#pragma GCC optimize(2, 3, "Ofast")
#include <cstdio>
#include <cstring>
#include <iostream>
using std :: swap;
#define rep(i,s,t) for(int i=s;i<=t;++i)
#define per(i,t,s) for(int i=t;i>=s;--i)
#define elif else if
#define gup(x) return puts(#x), 0
namespace MyMinMax{
    template <typename T>
    inline T mn(T x, T y) {return x < y ? x : y;}
    template <typename T>
    inline T mx(T x, T y) {return x > y ? x : y;}
    template <typename T>
    inline void chmin(T &x, T y) {(x > y) && (x = y);}
    template <typename T>
    inline void chmax(T &x, T y) {(x < y) && (x = y);}
}
using namespace MyMinMax;
namespace IO{
    #define getcha() (SS == TT && (TT = (SS = BB) + fread(BB, 1, 1 << 22, stdin), SS == TT) ? EOF : *SS++)
    char BB[1 << 22], *SS = BB, *TT = BB;
    template <typename T>
    inline void read(T &x){
        x = 0;int fu = 1;
        char c = getcha();
        while(c > 57 || c < 48){
            if(c == 45) fu = -1;
            c = getcha();
        }
        while(c <= 57 && c >= 48){
            x = x * 10 + c - 48;
            c = getcha();
        }
        x *= fu;
    }
    template <typename T>
    inline void read(T *bg, T *ed){while(bg != ed) read(*(bg ++));}
    template <typename T, typename ...Args>
    inline void read(T &x, Args &...args){read(x);read(args...);}
    char out[1 << 22], *Out = out;
    #define flush() fwrite(out, 1, Out - out, stdout)
    inline void putcha(char x) {*Out++ = x;if(Out - out >= (1 << 22)) flush(), Out = out;}
    template <typename T>
    inline void fprint(T x){
        if(x < 0) putcha(45), x = -x;
        if(x > 9) fprint(x / 10);
        putcha(x % 10 + 48);
    }
    template <typename T>
    inline void print(T x){fprint(x);putcha(10);}
    inline void print(const char *ch){while(*ch != '\0') putcha(*(ch ++));}
    inline void put(const char *ch){while(*ch != '\0') putcha(*(ch ++));putcha(10);}
    template <typename T, typename ...Args>
    inline void print(T x, Args ...args){fprint(x);putcha(32);print(args...);}
    template <typename ...Args>
    inline void print(const char *ch, Args ...args){while(*ch != '\0') putcha(*(ch ++));putcha(32);print(args...);}
    template <typename T, typename ...Args>
    inline void printl(T x, Args ...args){fprint(x);putcha(10);print(args...);}
    template <typename ...Args>
    inline void printl(const char *ch, Args ...args){while(*ch != '\0') putcha(*(ch ++));putcha(10);print(args...);}
    template <typename T>
    inline void sprint(T x){fprint(x);putcha(32);}
    template <typename T, typename ...Args>
    inline void sprint(T x, Args ...args){fprint(x);putcha(32);sprint(args...);}
    template <typename T>
    inline void sprint(T *bg, T *ed){while(bg != ed) sprint(*(bg ++));}
    template <typename T>
    inline void print(T *bg, T *ed){while(bg != ed) sprint(*(bg ++));putcha(10);}
    template <typename T>
    inline void printl(T *bg, T *ed){while(bg != ed) print(*(bg ++));}
    class AutoFlush{
        public:
            ~AutoFlush(){flush();}
    }__AutoFlush;
} // namespace IO
using namespace IO;
typedef long long LL;
#define INF 0x3f3f3f3f
//明镜止水之心
#define MAXN 100005
const int block = 512;
const int B = MAXN / block + 5;
int n, m;
int a[MAXN];//维护真实值，需要考虑标记
int bel[MAXN], fst[B], lst[B], tag[B];//tag 当且仅当这个块可以整块修改了才会有值，否则直接暴力
bool sk[B];//是否真实值全在块外，如果不在则需要在修改时重构，然后判断
int fa[MAXN];
//维护没有全在块外则维护块内最前一个
inline void rebuild(int x){
    //如果全在块外了那么答案只可能更小，所以应该不需要rebuild直接标记永久化更好
    //所以全在块外的不需要重构
    //这里我们认为修改好了才来重构
    sk[x] = 1;
    rep(i, fst[x], lst[x]){
        if(bel[a[i]] ^ x) fa[i] = i;
        else fa[i] = fa[a[i]], sk[x] = 0;
    }
}
inline void modify(int l, int r, int x){
    int L = bel[l], R = bel[r];
    if(L == R){
        rep(i, l, r) a[i] = mx(a[i] - x, 1);
        if(!sk[L]) rebuild(L);
    }
    else{
        rep(i, l, lst[L]) a[i] = mx(a[i] - x, 1);
        if(!sk[L]) rebuild(L);
        rep(i, fst[R], r) a[i] = mx(a[i] - x, 1);
        if(!sk[R]) rebuild(R);
        rep(i, L + 1, R - 1){
            if(!sk[i]){
                rep(j, fst[i], lst[i]) a[j] = mx(a[j] - x, 1);
                rebuild(i);
            }
            else tag[i] = (tag[i] + x >= n? n : tag[i] + x);
        }
    }
}
inline void swap(int &x, int &y){int tmp = x;x = y;y = tmp;}
inline int query(int x, int y){
    while((bel[x] ^ bel[y]) || (bel[x] == bel[y] && ((!sk[bel[x]] && (fa[x] ^ fa[y])) || (sk[bel[x]] && (a[x] ^ a[y]))))){
        if(bel[x] == bel[y]){
            if(sk[bel[x]]) x = mx(a[x] - tag[bel[x]], 1), y = mx(a[y] - tag[bel[y]], 1);
            else x = a[fa[x]], y = a[fa[y]];
        }
        else {
            if(bel[x] < bel[y]) swap(x, y);
            if(!sk[bel[x]]) x = a[fa[x]];
            else x = mx(a[x] - tag[bel[x]], 1);
        }
    }
    while(x ^ y){
        if(x > y) x = mx(a[x] - tag[bel[x]], 1);
        else y = mx(a[y] - tag[bel[y]], 1);
    }
    return x;
}
inline void init(){
    rep(i, 1, n) bel[i] = (i - 1) / block + 1;
    rep(i, 1, bel[n]){
        fst[i] = lst[i - 1] + 1;
        lst[i] = mn(n, i * block);
    }
    bel[1] = 0;fst[1] = 2;
    rep(i, 1, bel[n]) rebuild(i);
}
int main(){
    read(n, m);read(a + 2, a + n + 1);
    init();
    while(m --){
        int opt, l, r, x;read(opt, l, r);
        if(opt == 1) read(x), modify(l, r, x);
        else print(query(l, r));
    }
}