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>

#define ln                 '\n'
#define all(dat)           dat.begin(), dat.end()
#define loop(i, to)        for (int i = 0; i < to; ++i)
#define cont(i, to)        for (int i = 1; i <= to; ++i)
#define circ(i, fm, to)    for (int i = fm; i <= to; ++i)
#define foreach(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)

typedef long long          num;

using namespace std;

const int nsz = 1e5, Bsz = 320, Bcnt = nsz / Bsz + 1;
int n, m, B, pr[nsz + 5];

struct block {
	bool f;
	int l, r, sz, del, to[Bsz + 5];
	
	block(): f(0), del(0) {}
	block(int l, int r): f(0), l(l), r(r), sz(r - l + 1), del(0) {
		circ (u, l, r) to[at(u)] = ::pr[u];
		upd_all(0);
	}
	
	int inline id(int i) { return l + i - 1; }
	
	int inline at(int id) { return id - l + 1; }
	
	int inline go(int id) {
		return f ? max(pr[id] - del, 1) : to[at(id)]; }
	
	void inline upd_all(int w) {
		
		// cerr << this->l << ' ' << this->r << " upd_all: " << w << ln;
		
		if (f) del += w;
		else upd(1, sz, w);
	}
	
	void inline upd(int l, int r, int w) {
		// cerr << this->l << ' ' << this->r << " upd: " << l << ' ' << r << ' ' << w << ln;
		if (f) circ (i, l, r) pr[id(i)] -= w;
		else {
			f = 1;
			circ (i, l, r) {
				pr[id(i)] -= w, pr[id(i)] = max(pr[id(i)], 1);
				// cerr << i << ": " << pr[i] << ln;
			}
			cont (i, sz) {
				to[i] = pr[id(i)] < this->l ? pr[id(i)] : to[at(pr[id(i)])], f &= pr[id(i)] < this->l;
			}
		}
		
		// cont (i, sz) {
		// 	cerr << i << ' ' << id(i) << ": " << pr[i] << ' ' << to[i] << ln;
		// }
	}
	
	int inline qry(int i, int j) {
		
		// cerr << l << ' ' << r << ": " << id(i) << ' ' << id(j) << ln;
		// cerr << "? " << i << ' ' << j << ln;
		// circ (i, l, r) {
		// 	cerr << pr[i] << ln;
		// }
		
		for (; i != j; j = at(max(pr[id(j)] - del, 1))) {
			if (i > j) swap(i, j);
			
			// cerr << i << ' ' << j << ln;
		}
		// cerr << " -> " << i << ": " << id(i) << ln;
		return i;
	}
};
block b[Bcnt + 5];

void inline init() {
	B = max(int(ceil(sqrt(n))), 2);
	for (int l = 1, r = B - 1, id = 1; l <= n; l = r + 1, r += B, ++id) {
		r = min(r, n);
		b[id] = block(l, r);
	}
	
	// cerr << "block size: " << B << ln << ln;
}

void inline upd(int l, int r, int w) {
	int bl = l / B + 1, br = r / B + 1;
	if (bl == br) return (void) (b[bl].upd(b[bl].at(l), b[bl].at(r), w));
	b[bl].upd(b[bl].at(l), b[bl].sz, w);
	circ (id, bl + 1, br - 1) b[id].upd_all(w);
	b[br].upd(1, b[br].at(r), w);
}

int inline qry(int u, int v) {
	if (u > v) swap(u, v);
	
	// cerr << u << ' ' << v << ln;
	
	for (; u / B != v / B; v = b[v / B + 1].go(v)) {
		if (u > v) swap(u, v);
	}
	int id = u / B + 1;
	
	// cerr << u << ' ' << v << " id: " << id << ln;
	
	for (;;) {
		int nu = b[u / B + 1].go(u), nv = b[v / B + 1].go(v);
		if (nu != nv) {
			int bu = nu / B + 1, bv = nv / B + 1;
			// cerr << " -> " << bu << ' ' << bv << ' ' << nu << ' ' << nv << ln;
			if (bu == bv) u = nu, v = nv;
			if (bu < bv) v = nv;
			if (bu > bv) u = nu;
			// cerr << u << ' ' << v << ln;
		}
		else break;
		// cerr << u / B + 1 << ' ' << v / B + 1 << ln;
		// cerr << u << ' ' << b[u / B + 1].go(u) << ", " << v << ' ' << b[v / B + 1].go(v) << ln;
	}
	int bu = u / B + 1, bv = v / B + 1;
	if (bu != bv) return b[bu].go(u);
	id = bu;
	
	// cerr << "go!" << ln;
	
	return b[id].id(b[id].qry(b[id].at(u), b[id].at(v)));
}

void inline dbg() {
	cont (i, n) cerr << pr[i] << "\n "[i < n];
}

int main() {
	scanf("%d%d", &n, &m);
	cont (u, n) if (u == 1) pr[u] = 1; else scanf("%d", &pr[u]);
	init();
	cont (i, m) {
		int tp, l, r, w, u, v;
		scanf("%d", &tp);
		if (tp == 1) {
			scanf("%d%d%d", &l, &r, &w);
			upd(l, r, w);
		} else if (tp == 2) {
			scanf("%d%d", &u, &v);
			printf("%d\n", qry(u, v));
		}
		// cerr << i << ": " << tp << ln;
		// dbg();
		// cerr << "____________________" << ln;
	}
}