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>
using namespace std;
const int maxn = 200100;
struct tree {
  int l, r;
  long long c1, c2, tag;
} d[maxn << 2];
struct edge {
  int to, nex, dis;
} e[maxn << 1];
int n, Q, cnt, cc;
int st[maxn], en[maxn], fa[maxn], dep[maxn], mindis[maxn], dis[maxn], a[maxn],
    son[maxn], sz[maxn], head[maxn];
int top[maxn], pp[maxn];
void add(int x, int y, int z) {
  e[++cnt].to = y;
  e[cnt].dis = z;
  e[cnt].nex = head[x];
  head[x] = cnt;
}
void dfs1(int x, int father) {
  fa[x] = father;
  dep[x] = dep[father] + 1;
  son[x] = -1;
  sz[x] = 1;
  for (int i = head[x]; i; i = e[i].nex) {
    int v = e[i].to;
    if (v == father) continue;
    dis[v] = dis[x] + e[i].dis;
    dfs1(v, x);
    if (son[x] == -1 || sz[v] > sz[son[x]]) son[x] = v;
    sz[x] += sz[v];
  }
}
void dfs2(int x, int tp) {
  top[x] = tp;
  st[x] = ++cc;
  pp[cc] = x;
  if (son[x] != -1) dfs2(son[x], tp);
  for (int i = head[x]; i; i = e[i].nex)
    if (e[i].to != fa[x] && e[i].to != son[x]) dfs2(e[i].to, e[i].to);
  en[x] = cc;
}
void pushdown(int o) {
  if (!d[o].tag || d[o].l == d[o].r) return;
  d[o << 1].c1 += d[o].tag;
  d[o << 1].c2 += d[o].tag;
  d[o << 1].tag += d[o].tag;
  d[o << 1 | 1].c1 += d[o].tag;
  d[o << 1 | 1].c2 += d[o].tag;
  d[o << 1 | 1].tag += d[o].tag;
  d[o].tag = 0;
}
void update(int o) { d[o].c2 = min(d[o << 1].c2, d[o << 1 | 1].c2); }
void build(int o, int l, int r) {
  d[o].l = l;
  d[o].r = r;
  if (l == r) {
    d[o].c1 = dis[pp[l]];
    d[o].c2 = dis[pp[l]] + a[pp[l]];
    return;
  }
  int mid = (l + r) >> 1;
  build(o << 1, l, mid);
  build(o << 1 | 1, mid + 1, r);
  update(o);
}
void change1(int o, int l, int r, long long val) {
  if (d[o].l == l && d[o].r == r) {
    d[o].c1 += val;
    d[o].c2 += val;
    d[o].tag += val;
    return;
  }
  pushdown(o);
  int mid = (d[o].l + d[o].r) >> 1;
  if (r <= mid)
    change1(o << 1, l, r, val);
  else if (l > mid)
    change1(o << 1 | 1, l, r, val);
  else
    change1(o << 1, l, mid, val), change1(o << 1 | 1, mid + 1, r, val);
  update(o);
}
void change2(int o, int x, long long val) {
  if (d[o].l == d[o].r) {
    d[o].c2 += val;
    return;
  }
  pushdown(o);
  int mid = (d[o].l + d[o].r) >> 1;
  if (x <= mid)
    change2(o << 1, x, val);
  else
    change2(o << 1 | 1, x, val);
  update(o);
}
long long query1(int o, int x) {
  if (d[o].l == d[o].r) return d[o].c1;
  int mid = (d[o].l + d[o].r) >> 1;
  pushdown(o);
  if (x <= mid)
    return query1(o << 1, x);
  else
    return query1(o << 1 | 1, x);
}
long long query2(int o, int l, int r) {
  if (d[o].l == l && d[o].r == r) return d[o].c2;
  int mid = (d[o].l + d[o].r) >> 1;
  pushdown(o);
  if (r <= mid)
    return query2(o << 1, l, r);
  else if (l > mid)
    return query2(o << 1 | 1, l, r);
  else
    return min(query2(o << 1, l, mid), query2(o << 1 | 1, mid + 1, r));
}
int LCA(int x, int y) {
  while (top[x] != top[y]) {
    if (dep[x] < dep[y]) swap(x, y);
    x = fa[top[x]];
  }
  return dep[x] < dep[y] ? x : y;
}
int X[maxn << 1], Y[maxn << 1], Z[maxn << 1];
int main() {
  scanf("%d%d", &n, &Q);
  for (int i = 1; i < n; i++) {
    scanf("%d%d%d", &X[i], &Y[i], &Z[i]);
    add(X[i], Y[i], Z[i]);
  }
  for (int i = n; i <= 2 * n - 2; i++) {
    scanf("%d%d%d", &X[i], &Y[i], &Z[i]);
    a[X[i]] = Z[i];
  }
  dfs1(1, 0);
  dfs2(1, 1);
  build(1, 1, n);
  while (Q--) {
    int opt, x, y;
    scanf("%d%d%d", &opt, &x, &y);
    if (opt == 1) {
      if (x < n)
        change1(1, st[Y[x]], en[Y[x]], y - Z[x]), Z[x] = y;
      else
        change2(1, st[X[x]], y - Z[x]), Z[x] = y;
    } else {
      int lca = LCA(x, y);
      if (x == lca)
        printf("%I64d\n", query1(1, st[y]) - query1(1, st[x]));
      else {
        printf("%I64d\n",
               query2(1, st[x], en[x]) - query1(1, st[x]) + query1(1, st[y]));
      }
    }
  }
  return 0;
}
