description: Chanek Jones is back, helping his long-lost relative Indiana Jones, to find a secret treasure in a maze buried below a desert full of illusions.
  
  The map of the labyrinth forms a tree with n rooms numbered from 1 to n and n - 1 tunnels connecting them such that it is possible to travel between each pair of rooms through several tunnels.
  
  The i-th room (1 ≤ i ≤ n) has a_i illusion rate. To go from the x-th room to the y-th room, there must exist a tunnel between x and y, and it takes max(|a_x + a_y|, |a_x - a_y|) energy. |z| denotes the absolute value of z.
  
  To prevent grave robbers, the maze can change the illusion rate of any room in it. Chanek and Indiana would ask q queries.
  
  There are two types of queries to be done:
  
    * 1\ u\ c — The illusion rate of the x-th room is changed to c (1 ≤ u ≤ n, 0 ≤ |c| ≤ 10^9). 
    * 2\ u\ v — Chanek and Indiana ask you the minimum sum of energy needed to take the secret treasure at room v if they are initially at room u (1 ≤ u, v ≤ n). 
  
  
  
  Help them, so you can get a portion of the treasure!
  
  Input
  
  The first line contains two integers n and q (2 ≤ n ≤ 10^5, 1 ≤ q ≤ 10^5) — the number of rooms in the maze and the number of queries.
  
  The second line contains n integers a_1, a_2, …, a_n (0 ≤ |a_i| ≤ 10^9) — inital illusion rate of each room.
  
  The i-th of the next n-1 lines contains two integers s_i and t_i (1 ≤ s_i, t_i ≤ n), meaning there is a tunnel connecting s_i-th room and t_i-th room. The given edges form a tree.
  
  The next q lines contain the query as described. The given queries are valid.
  
  Output
  
  For each type 2 query, output a line containing an integer — the minimum sum of energy needed for Chanek and Indiana to take the secret treasure.
  
  Example
  
  Input
  
  
  6 4
  10 -9 2 -1 4 -6
  1 5
  5 4
  5 6
  6 2
  6 3
  2 1 2
  1 1 -3
  2 1 2
  2 3 3
  
  
  Output
  
  
  39
  32
  0
  
  Note
  
  <image>
  
  In the first query, their movement from the 1-st to the 2-nd room is as follows.
  
    * 1 → 5 — takes max(|10 + 4|, |10 - 4|) = 14 energy. 
    * 5 → 6 — takes max(|4 + (-6)|, |4 - (-6)|) = 10 energy. 
    * 6 → 2 — takes max(|-6 + (-9)|, |-6 - (-9)|) = 15 energy. 
  
  In total, it takes 39 energy.
  
  In the second query, the illusion rate of the 1-st room changes from 10 to -3.
  
  In the third query, their movement from the 1-st to the 2-nd room is as follows.
  
    * 1 → 5 — takes max(|-3 + 4|, |-3 - 4|) = 7 energy. 
    * 5 → 6 — takes max(|4 + (-6)|, |4 - (-6)|) = 10 energy. 
    * 6 → 2 — takes max(|-6 + (-9)|, |-6 - (-9)|) = 15 energy. 
  
  
  
  Now, it takes 32 energy.
solution: #include <bits/stdc++.h>
  #pragma GCC optimize("O3")
  #pragma GCC target("sse4,avx2,abm,fma,tune=native")
  #pragma GCC optimize("unroll-loops")
  using namespace std;
  const long long INF = 0x3f3f3f3f;
  const long long inf = pow(10, 18);
  long long modulo = pow(10, 9) + 7;
  long long valn[100100];
  long long val[100100];
  long long dp[100100];
  vector<long long> sorted[100100];
  vector<long long> g[100100];
  long long lca[100100][20];
  long long dep[100100];
  long long tin[100100];
  long long tout[100100];
  long long calcval(long long a, long long b) {
    return max(abs(a + b), abs(a - b));
  }
  void dfslca(long long hd, long long pr, long long& tim) {
    lca[hd][0] = pr;
    tin[hd] = tim;
    for (auto hr : g[hd]) {
      if (hr == pr) continue;
      dep[hr] = dep[hd] + 1;
      ++tim;
      sorted[hd].push_back(hr);
      dfslca(hr, hd, tim);
    }
    tout[hd] = tim;
  }
  void pre(long long n) {
    for (long long j = 1; j < 20; j++)
      for (long long i = 0; i < n; i++) lca[i][j] = lca[lca[i][j - 1]][j - 1];
  }
  long long LCA(long long a, long long b) {
    if (dep[a] < dep[b]) swap(a, b);
    for (long long j = 20 - 1; j > -1; j--)
      if (dep[lca[a][j]] > dep[b]) a = lca[a][j];
    if (dep[a] != dep[b]) a = lca[a][0];
    for (long long j = 20 - 1; j > -1; j--)
      if (lca[a][j] != lca[b][j]) a = lca[a][j], b = lca[b][j];
    if (a != b) a = lca[a][0], b = lca[b][0];
    return a;
  }
  void calcdp(long long hd, long long pr) {
    for (auto& hr : g[hd]) {
      if (hr == pr) {
        continue;
      }
      dp[hr] = dp[hd] + calcval(val[hd], val[hr]);
      calcdp(hr, hd);
    }
  }
  bool isp(long long pr, long long hd) {
    return tin[pr] <= tin[hd] && tout[hd] <= tout[pr];
  }
  long long findChild(long long pr, long long hd) {
    long long lo = 0, hi = (long long)sorted[pr].size() - 1;
    while (lo < hi) {
      long long mid = (lo + hi) / 2 + 1;
      long long hr = sorted[pr][mid];
      if (tin[hr] > tin[hd]) {
        hi = mid - 1;
      } else {
        lo = mid;
      }
    }
    return sorted[pr][lo];
  }
  void deal() {
    long long n, q;
    cin >> n >> q;
    for (long long i = 0; i < n; i++) {
      cin >> val[i];
      valn[i] = val[i];
    }
    for (long long i = 0; i < n - 1; i++) {
      long long ai, bi;
      cin >> ai >> bi;
      --ai, --bi;
      g[ai].push_back(bi);
      g[bi].push_back(ai);
    }
    {
      long long tim = 1;
      dfslca(0, 0, tim);
      pre(n);
      calcdp(0, 0);
    }
    map<long long, long long> dif;
    for (long long l = 0; l < q; l++) {
      long long ty;
      cin >> ty;
      if (ty == 1) {
        long long u, c;
        cin >> u >> c;
        --u;
        dif[u] = c;
        valn[u] = c;
      } else {
        long long u, v;
        cin >> u >> v;
        --u, --v;
        long long lc = LCA(u, v);
        long long ans = dp[u] + dp[v] - 2 * dp[lc];
        unordered_set<long long> again;
        for (auto& el : dif) {
          long long pr = el.first;
          long long p1 = isp(pr, u);
          long long p2 = isp(pr, v);
          if (p1 && (!p2 || pr == lc) && pr != u) {
            long long a = pr;
            long long b = findChild(pr, u);
            if (b < a) {
              swap(a, b);
            }
            again.insert(a * 100100 + b);
          }
          if (p2 && (!p1 || pr == lc) && pr != v) {
            long long a = pr;
            long long b = findChild(pr, v);
            if (b < a) {
              swap(a, b);
            }
            again.insert(a * 100100 + b);
          }
          if (lca[pr][0] != pr &&
              ((p1 ^ p2) || (lca[pr][0] == lc && (p1 || p2)))) {
            long long a = pr;
            long long b = lca[pr][0];
            if (b < a) {
              swap(a, b);
            }
            again.insert(a * 100100 + b);
          }
        }
        for (auto& el : again) {
          long long a = el / 100100, b = el % 100100;
          ans -= calcval(val[a], val[b]);
          ans += calcval(valn[a], valn[b]);
        }
        cout << ans << '\n';
      }
      if ((long long)dif.size() > 300) {
        for (long long i = 0; i < n; i++) {
          val[i] = valn[i];
        }
        calcdp(0, 0);
        dif.clear();
      }
    }
  }
  int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    deal();
  }
  