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;
int n, q;
vector<pair<int, int> > v[200010];
int ind[200010];
int r[200010];
int dep[200010];
bool vis[200010];
int par[200010][22];
int len[400010];
int nxt[400010];
int s[200010];
int disto1[200010];
struct segment_tree {
  int inc[1 << 20], N, sz, mn[1 << 20];
  void init() {
    N = 1;
    while (N < n) N *= 2;
    for (int i = 0; i < N * 2 - 1; i++) mn[i] = 1e9, inc[i] = 0;
  }
  void ins(int x) {
    int pos = N - 1 + (sz++);
    ind[x] = sz;
    mn[pos] = dep[x] + disto1[x];
    pushup(pos);
  }
  void pushup(int x) {
    while (x > 0) {
      x = (x - 1) >> 1;
      mn[x] = min(mn[(x << 1) + 1], mn[(x << 1) + 2]) + inc[x];
    }
  }
  void update(int a, int b, int k, int l, int r, int v) {
    if (a >= r || b <= l) return;
    if (a <= l && b >= r)
      inc[k] += v, mn[k] += v, pushup(k);
    else {
      update(a, b, (k << 1) + 1, l, (l + r) >> 1, v);
      update(a, b, (k << 1) + 2, (l + r) >> 1, r, v);
    }
  }
  int gtdep(int x) {
    int pos = N - 2 + ind[x];
    int res = mn[pos];
    while (pos > 0) {
      pos = (pos - 1) >> 1;
      res += inc[pos];
    }
    return res - disto1[x];
  }
  int query(int a, int b, int k, int l, int r, int v) {
    if (a >= r || b <= l) return 1e9;
    if (a <= l && b >= r) return mn[k] + v;
    return min(query(a, b, (k << 1) + 1, l, (l + r) >> 1, v + inc[k]),
               query(a, b, (k << 1) + 2, (l + r) >> 1, r, v + inc[k]));
  }
} tr;
void dfs(int x) {
  tr.ins(x);
  vis[x] = true;
  r[x] = ind[x];
  for (int i = 0; i < v[x].size(); i++) {
    int y = v[x][i].first, d = v[x][i].second;
    if (vis[y]) continue;
    dep[y] = dep[x] + len[d];
    s[y] = s[x] + 1;
    nxt[d] = y;
    par[y][0] = x;
    dfs(y);
    r[x] = max(r[x], r[y]);
  }
}
void updep(int x, int v) { tr.update(ind[x] - 1, r[x], 0, 0, tr.N, v); }
int lca(int x, int y) {
  if (x == y) return x;
  if (s[x] < s[y]) swap(x, y);
  int des = s[x] - s[y];
  int cj = 1, ss = 0;
  while (cj <= des) cj *= 2, ss++;
  cj /= 2;
  ss--;
  while (des) {
    if (des >= cj) {
      des -= cj;
      x = par[x][ss];
    }
    cj /= 2;
    ss--;
  }
  if (x == y) return x;
  ss = 0;
  while (par[x][ss] != par[y][ss]) ss++;
  ss--;
  if (ss < 0) return par[x][0];
  x = par[x][ss];
  y = par[y][ss];
  while (ss) {
    if (x == y) return x;
    while (ss >= 0 && par[x][ss] == par[y][ss]) ss--;
    if (ss < 0) return par[x][0];
    x = par[x][ss];
    y = par[y][ss];
  }
  if (x == y) return x;
  return par[x][0];
}
int main() {
  scanf("%d%d", &n, &q);
  tr.init();
  for (int i = 1; i < n; i++) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    v[a].push_back(make_pair(b, i));
    len[i] = c;
  }
  for (int i = 2; i <= n; i++) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    disto1[a] = c;
    nxt[i + n - 2] = a;
  }
  dfs(1);
  for (int i = 1; i <= 20; i++) {
    for (int j = 2; j <= n; j++) par[j][i] = par[par[j][i - 1]][i - 1];
  }
  for (int i = 1; i <= q; i++) {
    int t;
    scanf("%d", &t);
    if (t == 1) {
      int i, w;
      scanf("%d%d", &i, &w);
      if (i <= n - 1) {
        updep(nxt[i], w - len[i]);
        len[i] = w;
      } else {
        tr.mn[ind[nxt[i]] + tr.N - 2] += w - disto1[nxt[i]];
        disto1[nxt[i]] = w;
        tr.pushup(ind[nxt[i]] + tr.N - 2);
      }
    } else {
      int u, v;
      scanf("%d%d", &u, &v);
      int res = 1e9;
      int du = tr.gtdep(u), dv = tr.gtdep(v);
      if (lca(u, v) == u) res = dv - du;
      int to1 = tr.query(ind[u] - 1, r[u], 0, 0, tr.N, 0) - du;
      res = min(res, to1 + dv);
      printf("%d\n", res);
    }
  }
  return 0;
}
