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>
const int maxn = 2e5 + 10;
const long long INF = 1e18;
using namespace std;
int L[maxn], R[maxn], wt[maxn];
int n, q, k, son[maxn];
int to_node[2 * maxn], to_node_number[2 * maxn];
long long dis[maxn];
vector<pair<int, int> > G[2 * maxn];
int anc[maxn][20], p[maxn], deep[maxn];
void dfs(int u, int fa, long long d, int dep) {
  L[u] = k;
  p[u] = fa;
  dis[k++] = d + to_node[u];
  deep[u] = dep;
  for (int i = 0; i < G[u].size(); i++) {
    int v = G[u][i].first, w = G[u][i].second;
    if (u == fa) continue;
    dfs(v, u, d + w, dep + 1);
  }
  R[u] = k - 1;
}
void preprocess() {
  for (int i = 1; i <= n; i++) {
    anc[i][0] = p[i];
    for (int j = 1; (1 << j) < n; j++) anc[i][j] = -1;
  }
  for (int j = 1; (1 << j) < n; j++) {
    for (int i = 1; i <= n; i++) {
      if (anc[i][j - 1] == -1) continue;
      int a = anc[i][j - 1];
      anc[i][j] = anc[a][j - 1];
    }
  }
}
int LCA(int p, int q) {
  int lg;
  if (deep[p] < deep[q]) swap(p, q);
  for (lg = 1; (1 << lg) <= deep[p]; lg++)
    ;
  lg--;
  int ans = 0;
  for (int i = lg; i >= 0; i--) {
    if (deep[p] - (1 << i) >= deep[q]) p = anc[p][i];
  }
  if (p == q) return p;
  return -1;
}
long long C[maxn * 4], lazy[maxn * 4];
int m, ql, qr;
void build(int o, int l, int r) {
  if (l == r) {
    C[o] = dis[l];
    return;
  }
  int mid = (l + r) >> 1;
  build(o << 1, l, mid);
  build(o << 1 | 1, mid + 1, r);
  C[o] = min(C[o << 1], C[o << 1 | 1]);
}
void push_down(int o) {
  C[o << 1] += lazy[o];
  C[o << 1 | 1] += lazy[o];
  lazy[o << 1] += lazy[o];
  lazy[o << 1 | 1] += lazy[o];
  lazy[o] = 0;
}
long long query(int o, int l, int r) {
  if (l >= ql && r <= qr) return C[o];
  if (l > qr || r < ql) return INF;
  push_down(o);
  int mid = (l + r) >> 1;
  long long p1 = query(o << 1, l, mid);
  long long p2 = query(o << 1 | 1, mid + 1, r);
  C[o] = min(C[o << 1], C[o << 1 | 1]);
  return min(p1, p2);
}
void update(int o, int l, int r) {
  if (l >= ql && r <= qr) {
    C[o] += m;
    lazy[o] += m;
    return;
  }
  if (l > qr || r < ql) return;
  int mid = (l + r) >> 1;
  push_down(o);
  update(o << 1, l, mid);
  update(o << 1 | 1, mid + 1, r);
  C[o] = min(C[o << 1], C[o << 1 | 1]);
}
int main() {
  while (scanf("%d %d", &n, &q) != EOF) {
    k = 0;
    memset(C, 0, sizeof C);
    memset(lazy, 0, sizeof lazy);
    for (int i = 0; i < 2 * maxn; i++) G[i].clear();
    for (int i = 1; i <= 2 * n - 2; i++) {
      int u, v, w;
      scanf("%d %d %d", &u, &v, &w);
      if (i <= n - 1) {
        G[u].push_back(pair<int, int>(v, w));
        son[i] = v;
        wt[v] = w;
      } else {
        to_node[u] = w;
        to_node_number[i] = u;
      }
    }
    dfs(1, 0, 0, 1);
    preprocess();
    build(1, 0, k - 1);
    while (q--) {
      int op, u, v;
      scanf("%d %d %d", &op, &u, &v);
      if (op == 1) {
        if (u <= n - 1) {
          int sn = son[u], wi = wt[sn];
          ql = L[sn];
          qr = R[sn];
          m = v - wi;
          update(1, 0, k - 1);
          wt[sn] = v;
        } else {
          int vt = to_node_number[u];
          ql = qr = L[vt];
          m = v - to_node[vt];
          to_node[vt] = v;
          update(1, 0, k - 1);
        }
      } else {
        long long ans, ton = to_node[u];
        int nx = LCA(u, v);
        if (nx == u) {
          ql = qr = L[u];
          long long wu = query(1, 0, k - 1) - to_node[u];
          ql = qr = L[v];
          long long wv = query(1, 0, k - 1) - to_node[v];
          ans = wv - wu;
        } else {
          ql = L[u];
          qr = R[u];
          long long d1 = query(1, 0, k - 1);
          ql = qr = L[u];
          d1 -= (query(1, 0, k - 1) - to_node[u]);
          ql = qr = L[v];
          long long d2 = query(1, 0, k - 1);
          ans = d1 + d2 - to_node[v];
        }
        printf("%lld\n", ans);
      }
    }
  }
  return 0;
}
