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>
using namespace std;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define ll long long
#define ld long double
#define all(_v) _v.begin(), _v.end()
#define sz(_v) (int)_v.size()
#define pii pair <int, int>
#define pll pair <ll, ll>
#define veci vector <int>
#define vecll vector <ll>

const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
const double PI = 3.1415926535897932384626433832795;
const double eps = 1e-9;
const int MOD1 = 1e9 + 7;
const int MOD2 = 998244353;

const int MAXN = 1e5 + 10, K = 517;
int n, m;
ll a[MAXN];
int nxt[MAXN];
int bl[MAXN];
ll lazy[MAXN];
bool is_b[MAXN];

void build(int l, int r) {
    for(int i = l; i <= r; ++i) {
        int nx = (max(a[i] - lazy[bl[i]], 1ll));
        if(nx > 0 && bl[nx] == bl[i])
            nxt[i] = nxt[nx];
        else
            nxt[i] = i;
    }
}

void upd(int l, int r, int x) {
    while(l <= r) {
        if(((l > 1 && bl[l] != bl[l - 1]) || l == 1) && l + K <= r) {
            lazy[bl[l]] += x;
            if(!is_b[bl[l]]) build(bl[l] * K + 1, min(n, (bl[l] + 1) * K));
            if(lazy[bl[l]] > K) is_b[bl[l]] = 1;
            l += K;
        } else {
            int L = l;
            for(; l <= min(r, (bl[L] + 1) * K); ++l)
                a[l] = max(a[l] - x, 1ll);
            if(!is_b[bl[L]]) build(bl[L] * K + 1, min(n, (bl[L] + 1) * K));
        }
    }
}

int get(int v, int u) {
    if(v <= 1) return 1;
    if(u <= 1) return 1;
    if(v == u) return v;
    if(bl[v] == bl[u]) {
        if(nxt[v] == nxt[u]) {
            if(v > u) return get(u, max(a[v] - lazy[bl[v]], 1ll));
            else return get(v, max(a[u] - lazy[bl[u]], 1ll));
        }
    }
    if(v < u) return get(v, max(a[nxt[u]] - lazy[bl[u]], 1ll));
    else return get(u, max(a[nxt[v]] - lazy[bl[v]], 1ll));
}

void solve() {
    cin >> n >> m;
    for(int i = 2; i <= n; ++i) cin >> a[i], bl[i] = (i - 1) / K;
    build(1, n);
    for(int i = 1; i <= m; ++i) {
        int type;
        cin >> type;
        if(type == 1) {
            int l, r, x;
            cin >> l >> r >> x;
            upd(l, r, x);
        } else {
            int u, v;
            cin >> u >> v;
            if(u > v) swap(u, v);
            cout << get(u, v) << '\n';
        }
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int T = 1;
    ///cin >> T;
    while(T--) solve(), cout << '\n';
    return 0;
}