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 sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
// debug & operator << (debug & dd, P p) { dd << "(" << p.x << ", " << p.y << ")"; return dd; }

const int BLOCK_SIZE = 180;

int get_block(int i) {
	return i / BLOCK_SIZE;
}

bool is_first_in_block(int a) {
	return a == 0 || get_block(a) != get_block(a-1);
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, q;
	cin >> n >> q;
	vector<long long> parent(n);
	// parent[0] = 0
	vector<int> last_inside(n); // last ancestor in the same block
	int CNT_BLOCKS = get_block(n - 1) + 1;
	vector<long long> offset(CNT_BLOCKS);
	vector<bool> arr_is_inside(n, false);
	vector<set<int>> going_inside(CNT_BLOCKS);
	
	auto is_inside = [&](int x) {
		return arr_is_inside[x];
		// return going_inside[get_block(x)].count(x);
	};
	
	auto get_parent = [&](int x) {
		if(is_inside(x)) {
			return parent[x];
		}
		else {
			return max(0LL, parent[x] - offset[get_block(x)]);
		}
	};
	
	for(int i = 2; i <= n; ++i) {
		int x;
		cin >> x;
		parent[i-1] = x - 1;
	}
	for(int a = 0; a < n; ++a) {
		if(get_block(parent[a]) == get_block(a)) {
			arr_is_inside[a] = true;
			going_inside[get_block(a)].insert(a);
		}
		int x = a;
		while(x != 0 && get_block(parent[x]) == get_block(a)) {
			x = parent[x];
		}
		last_inside[a] = x;
	}
	while(q--) {
		int type;
		cin >> type;
		if(type == 1) {
			// update
			int low, high, diff;
			cin >> low >> high >> diff;
			low--;
			high--;
			for(int a = low; a <= high; ++a) {
				int block = get_block(a);
				
				auto handle_single_inside = [&](int x) {
					parent[x] = max(0LL, parent[x] - diff);
					if(x == 3) {
						debug() << imie(x) imie(parent[x]) imie(diff);
					}
					if(get_block(parent[x]) == block) {
						if(x == 3) {
							debug() << "T1";
						}
						last_inside[x] = last_inside[parent[x]];
					}
					else {
						if(x == 3) {
							debug() << "T2";
						}
						last_inside[x] = x;
						parent[x] += offset[block];
						going_inside[block].erase(x); // valid?
						arr_is_inside[x] = false;
					}
				};
				
				if(is_first_in_block(a) && a + BLOCK_SIZE - 1 <= high) {
					debug() << imie(a) imie(going_inside[block]) imie(block);
					// whole block
					assert(block < CNT_BLOCKS);
					auto tmp = going_inside[block];
					offset[block] += diff;
					for(int x : tmp) {
						handle_single_inside(x);
					}
					
					a += BLOCK_SIZE - 1;
				}
				else {
					// single element
					if(is_inside(a)) { //going_inside[block].count(a)) {
						handle_single_inside(a);
					}
					else {
						// element going directly outside of this block
						assert(last_inside[a] == a);
						parent[a] -= diff;
						// int real_parent = max(0, parent[a] - offset[block]);
					}
					if(a == high) {
						for(int z = a + 1; get_block(z) == get_block(a) && z < n; ++z) {
							// red part from drawing
							if(is_inside(z)) {
								last_inside[z] = last_inside[parent[z]];
							}
						}
					}
				}
			}
		}
		else {
			// debug() << imie(is_inside(3)) imie(offset[get_block(3)]);
			// return 0;
			// for(int a = 0; a < n; ++a) {
				// debug() << imie(a) << imie(is_inside(a)) << imie(get_parent(a)) imie(last_inside[a]);
			// }
			// query
			int x, y;
			cin >> x >> y;
			x--;
			y--;
			while(x != y) {
				debug() << imie(x) imie(y);
				if(x < y) {
					swap(x, y);
				}
				if(get_block(x) == get_block(y) && last_inside[x] == last_inside[y]) {
					// go 1 by 1
					assert(is_inside(x));
					x = parent[x];
				}
				else {
					// either different blocks, or they don't meet here
					x = last_inside[x];
					debug() << imie(x) imie(get_parent(x));
					assert(!is_inside(x));
					x = get_parent(x);
					// x = max(0, parent[x] - offset[get_block(x)]);
				}
			}
			cout << x + 1 << "\n";
		}
	}
}