You are given a directed weighted graph with n nodes and 2n - 2 edges. The nodes are labeled from 1 to n, while the edges are labeled from 1 to 2n - 2. The graph's edges can be split into two parts.

  * The first n - 1 edges will form a rooted spanning tree, with node 1 as the root. All these edges will point away from the root. 
  * The last n - 1 edges will be from node i to node 1, for all 2 ≤ i ≤ n. 



You are given q queries. There are two types of queries

  * 1 i w: Change the weight of the i-th edge to w
  * 2 u v: Print the length of the shortest path between nodes u to v



Given these queries, print the shortest path lengths.

Input

The first line of input will contain two integers n, q (2 ≤ n, q ≤ 200 000), the number of nodes, and the number of queries, respectively.

The next 2n - 2 integers will contain 3 integers ai, bi, ci, denoting a directed edge from node ai to node bi with weight ci.

The first n - 1 of these lines will describe a rooted spanning tree pointing away from node 1, while the last n - 1 of these lines will have bi = 1.

More specifically, 

  * The edges (a1, b1), (a2, b2), ... (an - 1, bn - 1) will describe a rooted spanning tree pointing away from node 1. 
  * bj = 1 for n ≤ j ≤ 2n - 2. 
  * an, an + 1, ..., a2n - 2 will be distinct and between 2 and n. 



The next q lines will contain 3 integers, describing a query in the format described in the statement.

All edge weights will be between 1 and 106.

Output

For each type 2 query, print the length of the shortest path in its own line.

Example

Input

5 9
1 3 1
3 2 2
1 4 3
3 5 4
5 1 5
3 1 6
2 1 7
4 1 8
2 1 1
2 1 3
2 3 5
2 5 2
1 1 100
2 1 3
1 8 30
2 4 2
2 2 4


Output

0
1
4
8
100
132
10
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
vector<vector<long long> > g;
vector<long long> par, A, B, L, R;
vector<pair<long long, long long> > E;
vector<long long> C, S;
long long cnt = 0;
template <class t>
class SegTreeLazy {
  vector<long long>*arr, st, lazy;
  long long n;
  void build(long long u, long long i, long long j) {
    if (i == j) {
      st[u] = (*arr)[i];
      return;
    }
    long long m = (i + j) / 2, l = u * 2 + 1, r = u * 2 + 2;
    build(l, i, m);
    build(r, m + 1, j);
    st[u] = t::merge_op(st[l], st[r]);
  }
  void propagate(long long u, long long i, long long j, long long x) {
    st[u] = t::range_op(st[u], i, j, x);
    if (i != j) {
      lazy[u * 2 + 1] = t::prop_op(lazy[u * 2 + 1], x);
      lazy[u * 2 + 2] = t::prop_op(lazy[u * 2 + 2], x);
    }
    lazy[u] = 0;
  }
  long long query(long long a, long long b, long long u, long long i,
                  long long j) {
    if (j < a or b < i) return t::neutro;
    if (lazy[u]) propagate(u, i, j, lazy[u]);
    if (a <= i and j <= b) return st[u];
    long long m = (i + j) / 2, l = u * 2 + 1, r = u * 2 + 2;
    long long x = query(a, b, l, i, m);
    long long y = query(a, b, r, m + 1, j);
    return t::merge_op(x, y);
  }
  void update(long long a, long long b, long long value, long long u,
              long long i, long long j) {
    if (lazy[u]) propagate(u, i, j, lazy[u]);
    if (a <= i and j <= b)
      propagate(u, i, j, value);
    else if (j < a or b < i)
      return;
    else {
      long long m = (i + j) / 2, l = u * 2 + 1, r = u * 2 + 2;
      update(a, b, value, l, i, m);
      update(a, b, value, r, m + 1, j);
      st[u] = t::merge_op(st[l], st[r]);
    }
  }

 public:
  SegTreeLazy(vector<long long>& v) {
    arr = &v;
    n = v.size();
    st.resize(n * 4 + 5);
    lazy.assign(n * 4 + 5, 0);
    build(0, 0, n - 1);
  }
  long long query(long long a, long long b) { return query(a, b, 0, 0, n - 1); }
  void update(long long a, long long b, long long value) {
    update(a, b, value, 0, 0, n - 1);
  }
};
struct RMinQ {
  static long long const neutro = LLONG_MAX;
  static long long merge_op(long long x, long long y) { return min(x, y); }
  static long long range_op(long long st_u, long long a, long long b,
                            long long x) {
    return st_u + x;
  }
  static long long prop_op(long long child, long long x) { return child + x; }
};
void dfs(long long u, long long c) {
  C[u] = c + A[u];
  S.push_back(C[u]);
  L[u] = cnt++;
  for (long long v : g[u]) {
    dfs(v, c + B[v]);
  }
  S.push_back(C[u]);
  R[u] = cnt++;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, q;
  cin >> n >> q;
  g.assign(n, vector<long long>());
  par.assign(n, -1);
  A.assign(n, 0);
  B.assign(n, 0);
  C.assign(n, 0);
  L.assign(n, 0);
  R.assign(n, 0);
  for (long long i = 0; i < n - 1; ++i) {
    long long u, v, w;
    cin >> u >> v >> w;
    u--, v--;
    par[v] = u;
    g[u].push_back(v);
    B[v] = w;
    E.push_back({u, v});
  }
  for (long long i = 0; i < n - 1; ++i) {
    long long u, v, w;
    cin >> u >> v >> w;
    u--, v--;
    E.push_back({u, v});
    A[u] = w;
  }
  dfs(0, 0);
  SegTreeLazy<RMinQ> stl(S);
  for (long long j = 0; j < q; ++j) {
    long long t, e, w;
    cin >> t >> e >> w;
    e--;
    long long u, v;
    if (t == 1) {
      u = E[e].first, v = E[e].second;
      if (e < n - 1) {
        long long dif = w - B[v];
        if (dif) {
          stl.update(L[v], R[v], dif);
          B[v] = w;
        }
      } else {
        long long dif = w - A[u];
        if (dif) {
          stl.update(L[u], L[u], dif);
          stl.update(R[u], R[u], dif);
          A[u] = w;
        }
      }
    } else {
      u = e;
      v = w - 1;
      if (L[u] <= L[v] && R[u] >= R[v]) {
        long long du = stl.query(L[u], L[u]) - A[u];
        long long dv = stl.query(L[v], L[v]) - A[v];
        cout << dv - du << "\n";
      } else {
        long long du = stl.query(L[u], R[u]) - stl.query(L[u], L[u]) + A[u];
        long long dv = stl.query(L[v], L[v]) - A[v];
        cout << du + dv << "\n";
      }
    }
  }
}
