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;
class YueTree
{
  private:
  int n, k;
  vector<int> p, j, unlocked, tag;
  inline int block_id(int v) { return (v + k - 1) / k; }
  inline int block_st(int i) { return max(0, (i - 1) * k + 1); }
  inline int block_ed(int i) { return min(i * k, n - 1); }
  inline int par(int v) { return max(p[v] + tag[block_id(v)], 0); }
  inline void update(int l, int r, int x);
  inline void calc_jump(int i);
  inline int lca(int u, int v);

  public:
  YueTree(int N);
  ~YueTree() = default;
  void input();
  void query(int q);
};
YueTree::YueTree(int N)
{
  n = N;
  k = sqrt(n);
  p = vector<int>(n, 0);
  j = vector<int>(n, 0);
  tag = vector<int>(block_id(n) + 1, 0);
  unlocked = vector<int>(block_id(n) + 1, 1);
}
void YueTree::input()
{
  for (int i = 1; i < n; i++)
    cin >> p[i], p[i]--;
  j[0] = 0;
  for (int i = 1; i <= block_id(n); i++)
    calc_jump(i);
}
void YueTree::query(int q)
{
  for (int i = 0; i < q; i++)
  {
    int s, x, y, z;
    scanf("%d%d%d", &s, &x, &y);
    if (s == 1)
      scanf("%d", &z), update(x - 1, y - 1, z);
    else
      printf("%d\n", lca(x - 1, y - 1) + 1);
  }
}
void YueTree::update(int l, int r, int x)
{
  int il = block_id(l), ir = block_id(r);
  if (il == ir)
  {
    for (int v = l; v <= r; v++)
      p[v] = max(0, p[v] - x);
    if (unlocked[il] != 0)
      calc_jump(il);
    return;
  }
  for (int v = l; v <= block_ed(il); v++)
    p[v] = max(0, p[v] - x);
  calc_jump(il);
  for (int i = il + 1; i < ir; i++)
  {
    if (abs(tag[i]) < 1e9)
      tag[i] -= x;
    if (unlocked[i] != 0)
      calc_jump(i);
  }
  for (int v = block_st(ir); v <= r; v++)
    p[v] = max(0, p[v] - x);
  calc_jump(ir);
}
void YueTree::calc_jump(int i)
{
  int l = block_st(i), r = block_ed(i);
  unlocked[i] = r - l + 1;
  for (int v = l; v <= r; v++)
  {
    if (par(v) < l)
      unlocked[i]--, j[v] = v;
    else
      j[v] = j[par(v)];
  }
}
int YueTree::lca(int u, int v)
{
  while (j[u] != j[v])
  {
    if (j[u] < j[v])
      swap(u, v);
    u = par(j[u]);
  }
  while (u != v)
  {
    if (u < v)
      swap(u, v);
    u = par(u);
  }
  return u;
}
int main()
{
  int n, q;
  scanf("%d%d", &n, &q);
  YueTree solution(n);
  solution.input();
  solution.query(q);
}