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;
const int N = 1e5+5;

int block;
int n,q,a[N],st[N],ed[N],pos[N],b[N],tag[N];

/*
分块
对每个点维护一个 b_i 表示第一个与 i 不在同一个块内的祖先

- 修改，对于散块，暴力重构；对于整块，打 tag 注意当 tag > 块长时，b_i = a_i
- 询问
	1、pos(x) != pos(y)，pos 大的跳 b
	2、pos(x) == pos(y)，b_x != b_y，同时跳 b
	3、pos(x) == pos(y)，编号大的跳父亲

标记不下传
*/

void rebuild(int i) {
	for(int j = st[i]; j <= ed[i]; ++j) {
		int to = max(a[j] - tag[pos[j]], 1);
		if(pos[to] != pos[j]) b[j] = to;
		else b[j] = b[to];
	}
}

int main() {
	
	
	scanf("%d%d",&n,&q);
	for(int i = 2; i <= n; ++i) scanf("%d",&a[i]);
	
	block = sqrt(n);
	
	for(int i = 1; i <= n; ++i) {
		pos[i] = (i+block-1)/block;
		if(pos[i] != pos[i-1]) ed[pos[i-1]] = i-1, st[pos[i]] = i;
	}
	ed[pos[n]] = n;

	for(int i = 1; i <= pos[n]; ++i) rebuild(i);

	// for(int i = 1; i <= n; ++i) cout << pos[i] << " "; cout << endl;

	// cout << "block = " << block << " ?\n";

	// cout << "checking:\n"; for(int i = 1; i <= n; ++i) cout << b[i] << " "; cout << endl;

	for(int cs = 1, op, l, r, x; cs <= q; ++cs) {
		scanf("%d%d%d",&op,&l,&r);
		if(op == 1) {
			scanf("%d",&x);
			if(pos[l] == pos[r]) {
				// cout << pos[l] << " = " << pos[r] << endl;
				for(int i = st[pos[l]], to; i <= ed[pos[r]]; ++i) {
					if(i >= l && i <= r) a[i] = max(a[i] - x, 1);
					to = max(a[i] - tag[pos[i]], 1);
					if(pos[to] != pos[i]) b[i] = to;
					else b[i] = b[to];
				}
			// cout << "checking:\n"; for(int i = 1; i <= n; ++i) cout << b[i] << " "; cout << endl;
				continue;
			}

			// cout << pos[l] << " " << pos[r] << " ?? \n";
			for(int i = pos[l] + 1; i < pos[r]; ++i) {
				tag[i] += x;
				tag[i] = min(tag[i], n);
			}
			
			for(int i = st[pos[l]], to; i <= ed[pos[l]]; ++i) {
				if(i >= l) a[i] = max(a[i] - x, 1);
				to = max(a[i] - tag[pos[i]], 1);
				if(pos[to] != pos[i]) b[i] = to;
				else b[i] = b[to];
				// cout << "L : " << i << " " << b[i] << endl;
			}
			
			for(int i = st[pos[r]], to; i <= ed[pos[r]]; ++i) {
				if(i <= r) a[i] = max(a[i] - x, 1);
				to = max(a[i] - tag[pos[i]], 1);
				if(pos[to] != pos[i]) b[i] = to;
				else b[i] = b[to];
				// cout << "R : " << i << " " << b[i] << endl;
			}
			// cout << "checking:\n"; for(int i = 1; i <= n; ++i) cout << b[i] << " "; cout << endl;
		}
		else {

			// cout << "checking:\n"; for(int i = 1; i <= n; ++i) cout << b[i] << " "; cout << endl;

			for(; l != r; ) {
				// cout << "?? " << l << " " << r << " ??\n";

				if(r < l) swap(l,r);
				if(tag[pos[r]] && tag[pos[r]] < block) rebuild(pos[r]);
				if(tag[pos[r]] >= block) b[r] = max(a[r] - tag[pos[r]], 1);

				if(tag[pos[l]] && tag[pos[l]] < block) rebuild(pos[l]);
				if(tag[pos[l]] >= block) b[l] = max(a[l] - tag[pos[l]], 1);

				if(pos[l] != pos[r]) {
					r = b[r];
				}
				else {
					if(b[l] == b[r]) r = max(a[r] - tag[pos[r]], 1);
					else l = b[l], r = b[r];
				}
			}
			printf("%d\n",l);
		}
	}

	return 0;
}

/*
1   2   3 | 4   5   6 | 7   8   9 |10  11  12 |13  14  15
-----------------------------------------------------------
0   1   2 | 2   1   5 | 4   3   6 | 5   7   9 | 2   3  10 

0   1   2   2   1   5   4   3  (1   1   2   4   1   1) 10 

0   1   2   2   1  (2   1   1)  2   1   3   4   1   1  10 

0   1   2   2   1   2   1   1   2   1   3   4   1   1  10 


15 3
1 2 2 1 5 4 3 6 5 7 9 2 3 10
1 9 14 5
1 6 8 3
2 12 11
*/