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;
struct Edge {
  long long to, nxt, w;
} edge[800006];
long long head[800006], tot, E[800006], n, q, deep[800006];
int has[800006 * 2];
void init() {
  memset(head, -1, sizeof head);
  tot = 0;
}
void addedge(long long u, long long v, long long w) {
  edge[tot].to = v;
  edge[tot].w = w;
  edge[tot].nxt = head[u];
  head[u] = tot++;
}
int id, l[800006], r[800006], inv[800006];
void dfs(int u, int fa, long long dep) {
  l[u] = r[u] = ++id;
  inv[id] = u;
  deep[u] = dep;
  for (int i = head[u]; i != -1; i = edge[i].nxt) {
    int v = edge[i].to;
    if (v == fa) continue;
    dfs(v, u, dep + edge[i].w);
    r[u] = max(r[u], r[v]);
  }
}
long long Min[800006 << 2], lazy[800006 << 2];
void pushup(int rt) { Min[rt] = min(Min[rt << 1], Min[rt << 1 | 1]); }
void pushdown(int rt) {
  if (lazy[rt]) {
    Min[rt << 1] += lazy[rt];
    Min[rt << 1 | 1] += lazy[rt];
    lazy[rt << 1] += lazy[rt];
    lazy[rt << 1 | 1] += lazy[rt];
    lazy[rt] = 0;
  }
}
void build(int l, int r, int rt) {
  lazy[rt] = 0;
  Min[rt] = 0;
  if (l == r) {
    if (inv[l] == 1) return;
    Min[rt] = deep[inv[l]] + E[inv[l]];
    return;
  }
  int m = l + r >> 1;
  build(l, m, rt << 1), build(m + 1, r, rt << 1 | 1);
  pushup(rt);
}
void update(int L, int R, int l, int r, int rt, long long val) {
  if (L <= l && R >= r) {
    Min[rt] += val;
    lazy[rt] += val;
    return;
  }
  pushdown(rt);
  int m = l + r >> 1;
  if (L <= m) update(L, R, l, m, rt << 1, val);
  if (R > m) update(L, R, m + 1, r, rt << 1 | 1, val);
  pushup(rt);
}
long long query(int L, int R, int l, int r, int rt) {
  if (L <= l && R >= r) return Min[rt];
  pushdown(rt);
  int m = l + r >> 1;
  long long res = 0x3f3f3f3f3f3f3f3f;
  if (L <= m) res = min(res, query(L, R, l, m, rt << 1));
  if (R > m) res = min(res, query(L, R, m + 1, r, rt << 1 | 1));
  pushup(rt);
  return res;
}
int main() {
  init();
  cin >> n >> q;
  long long u, v, w;
  for (int i = 1; i < n; i++) {
    scanf("%lld%lld%lld", &u, &v, &w);
    addedge(u, v, w);
  }
  for (int i = 1; i < n; i++) {
    scanf("%lld%lld%lld", &u, &v, &w);
    has[i + n - 1] = u;
    E[u] = w;
  }
  dfs(1, 0, 0);
  memset(Min, 0x3f, sizeof Min);
  build(1, n, 1);
  while (q--) {
    long long opt, a, b;
    scanf("%lld%lld%lld", &opt, &a, &b);
    if (opt == 1) {
      if (a <= n - 1) {
        a--;
        long long val = b - edge[a].w;
        edge[a].w = b;
        int v = edge[a].to;
        update(l[v], r[v], 1, n, 1, val);
      } else {
        long long val = b - E[has[a]];
        E[has[a]] = b;
        int v = has[a];
        update(l[v], l[v], 1, n, 1, val);
      }
    } else {
      long long disa = query(l[a], l[a], 1, n, 1) - E[a];
      long long disb = query(l[b], l[b], 1, n, 1) - E[b];
      long long tmp1 = query(l[a], r[a], 1, n, 1);
      if (l[b] >= l[a] && l[b] <= r[a])
        cout << disb - disa << '\n';
      else
        cout << tmp1 - disa + disb << '\n';
    }
  }
}
