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>

template <class T>
inline void read(T &res) {
  res = 0; bool bo = 0; char c;
  while (((c = getchar()) < '0' || c > '9') && c != '-');
  if (c == '-') bo = 1; else res = c - 48;
  while ((c = getchar()) >= '0' && c <= '9')
    res = (res << 3) + (res << 1) + (c - 48);
  if (bo) res = ~res + 1;
}

template <class T>
inline T Max(const T &a, const T &b) {return a > b ? a : b;}

template <class T>
inline T Min(const T &a, const T &b) {return a < b ? a : b;}

const int N = 1e5 + 5;

int n, q, a[N], S, bl[N], br[N], tot, add[N], mx[N], out[N], in[N];

void pushdown(int b) {
  mx[b] = 0;
  for (int i = bl[b]; i <= br[b]; i++) {
    mx[b] = Max(mx[b], a[i] = Max(1, a[i] - add[b]));
    out[i] = a[i] < bl[b] ? a[i] : out[a[i]];
  }
  add[b] = 0;
}

void change(int l, int r, int x) {
  int il = in[l], ir = in[r];
  if (il == ir) {
  	for (int i = l; i <= r; i++) a[i] -= x;
  	return pushdown(il);
  }
  for (int i = il + 1; i < ir; i++) {
  	add[i] = Min(n, add[i] + x);
  	if (mx[i] >= bl[i]) pushdown(i);
  	else mx[i] = Max(1, mx[i] - x);
  }
  for (int i = l; i <= br[il]; i++) a[i] -= x;
  for (int i = bl[ir]; i <= r; i++) a[i] -= x;
  pushdown(il); pushdown(ir);
}

int _out(int u) {
  int b = in[u];
  return mx[b] >= bl[b] ? out[u] : Max(1, a[u] - add[b]);
}

int lca(int u, int v) {
  if (u == 1 || v == 1) return 1;
  if (u < v) std::swap(u, v);
  int ou = _out(u), ov = _out(v);
  if (in[u] == in[v]) {
  	if (ou == ov) {
  	  while (u != v) {
  	  	if (u < v) std::swap(u, v);
  	  	u = Max(1, a[u] - add[in[u]]);
	  }
	  return u;
	}
	else return lca(ou, ov);
  }
  else return lca(ou, v);
}

int main() {
  int op, l, r, x;
  read(n); read(q); S = sqrt(n - 1);
  for (int i = 2; i <= n; i++) read(a[i]), in[i] = (i - 2) / S + 1;
  for (int i = 2; i <= n; i += S)
    bl[++tot] = i, br[tot] = Min(i + S - 1, n);
  for (int i = 1; i <= tot; i++) pushdown(i);
  while (q--) {
  	read(op); read(l); read(r);
  	if (op == 1) read(x), change(l, r, x);
  	else printf("%d\n", lca(l, r));
  }
  return 0;
}