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: wlzhouzhuan
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pb push_back
#define fir first
#define sec second
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define per(i, l, r) for (int i = l; i >= r; i--)
#define mset(s, t) memset(s, t, sizeof(s))
#define mcpy(s, t) memcpy(s, t, sizeof(t))
#define SZ(a) ((int)(a.size()))
template<typename T1, typename T2> void ckmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> void ckmax(T1 &a, T2 b) { if (a < b) a = b; }
int read() {
  int x = 0, f = 0; char ch = getchar();
  while (!isdigit(ch)) f |= ch == '-', ch = getchar();
  while (isdigit(ch)) x = 10 * x + ch - '0', ch = getchar();
  return f ? -x : x;
}
template<typename T> void print(T x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) print(x / 10);
  putchar(x % 10 + '0');
}
template<typename T> void print(T x, char let) {
  print(x), putchar(let);
}

const int N = 100005;
const int B = 355;

int n, q, L[N / B + 5], R[N / B + 5], be[N], sz;

int a[N], go[N], lzy[N];
int fa(int u) {
  return max(1, a[u] - lzy[be[u]]);
}
int jump(int u) {
  if (lzy[be[u]] < B) return go[u];
  else return fa(u);
}
void rebuild(int t) {
  for (int i = L[t]; i <= R[t]; i++) {
    int to = fa(i);
    if (to < L[t]) go[i] = to;
    else go[i] = go[to];
//    printf("go[%d] = %d\n", i, go[i]);
  }
}
void update(int l, int r, int x) {
  int bl = be[l], br = be[r];
  if (bl == br) {
    for (int i = l; i <= r; i++) a[i] = max(1, a[i] - x);
    rebuild(bl);
  } else {
    for (int i = l; i <= R[bl]; i++) a[i] = max(1, a[i] - x);
    rebuild(bl);
    for (int i = bl + 1; i <= br - 1; i++) {
      lzy[i] = min(lzy[i] + x, n);
      if (lzy[i] < B) rebuild(i);
    }
    for (int i = L[br]; i <= r; i++) a[i] = max(1, a[i] - x);
    rebuild(br);
  }
}
int LCA(int u, int v) {
  if (u == v) return u;
  int lstu = u, lstv = v;
  while (u != v) {
    if (u < v) swap(u, v), swap(lstu, lstv);
    lstu = u, u = jump(u);
  }
  if (u && be[lstu] != be[lstv]) return u;
//  printf("u = %d, v = %d, lstu = %d, lstv = %d\n", u, v, lstu, lstv);
  while (lstu != lstv) {
    if (lstu < lstv) swap(lstu, lstv);
    lstu = fa(lstu);
  }
  return lstu;
}
int main() {
  n = read(), q = read();
  for (int i = 2; i <= n; i++) a[i] = read();
  for (int l = 1; l <= n; l += B) {
    int r = min(l + B - 1, n);
    sz++, L[sz] = l, R[sz] = r;
    for (int i = l; i <= r; i++) be[i] = sz;
  }
  for (int i = 1; i <= sz; i++) rebuild(i);
  while (q--) {
    int opt = read();
    if (opt == 1) {
      int l = read(), r = read(), x = read();
      update(l, r, x);
    } else {
      int u = read(), v = read();
      print(LCA(u, v), '\n');
    }
  }
  return 0;
}