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 E {
  int a, b, c;
} ee[(2 * 200000)];
int *aa[200000], ai[200000], n_, tin[200000], tout[200000], ti = 0, up[200000];
long long st[(1 << 18) << 1], lz[(1 << 18) << 1];
void append(int i, int j) {
  int e = ai[i]++;
  if (e >= 2 && (e & (e - 1)) == 0)
    aa[i] = (int *)realloc(aa[i], 2 * e * sizeof *aa[i]);
  aa[i][e] = j;
}
void build(int n) {
  int i;
  n_ = 1;
  while (n_ < n) n_ *= 2;
  for (i = n; i < n_; ++i) st[i] = 0x3f3f3f3f3f3f3f3f;
  for (i = n_ - 1; i > 0; --i) st[i] = min(st[i << 1], st[i << 1 | 1]);
}
void push(int i, int l, int r) {
  int li = i << 1, ri = li | 1;
  st[i] += lz[i];
  if (l != r) lz[li] += lz[i], lz[ri] += lz[i];
  lz[i] = 0;
}
void update(int ql, int qr, long long x, int i = 1, int l = 0, int r = n_ - 1) {
  push(i, l, r);
  if (ql > r || qr < l) return;
  if (ql <= l && qr >= r) {
    lz[i] += x;
    return void(push(i, l, r));
  }
  int m = (l + r) >> 1, li = i << 1, ri = li | 1;
  update(ql, qr, x, li, l, m);
  update(ql, qr, x, ri, m + 1, r);
  st[i] = min(st[li], st[ri]);
}
long long query(int ql, int qr, int i = 1, int l = 0, int r = n_ - 1) {
  push(i, l, r);
  if (ql > r || qr < l) return 0x3f3f3f3f3f3f3f3f;
  if (ql <= l && qr >= r) return st[i];
  int m = (l + r) >> 1, li = i << 1, ri = li | 1;
  long long q1, q2;
  q1 = query(ql, qr, li, l, m);
  q2 = query(ql, qr, ri, m + 1, r);
  return min(q1, q2);
}
void dfs(int i, int k) {
  int e;
  tin[i] = ti++;
  if (i != 0) update(tin[i], tin[i], ee[up[i]].c);
  for (e = ai[i]; e--;) {
    int j = aa[i][e];
    if (ee[j].b != k) {
      dfs(ee[j].b, i);
      update(tin[ee[j].b], tout[ee[j].b], ee[j].c);
    }
  }
  tout[i] = ti - 1;
}
bool anc(int i, int j) { return tin[i] <= tin[j] && tout[i] >= tout[j]; }
long long getDist(int i) {
  if (i == 0) return query(tin[i], tin[i]);
  return query(tin[i], tin[i]) - ee[up[i]].c;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n, q, i;
  cin >> n >> q;
  build(n);
  for (i = 0; i < n; ++i) aa[i] = (int *)malloc(2 * sizeof *aa[i]), ai[i] = 0;
  for (i = 0; i < n - 1; ++i) {
    cin >> ee[i].a >> ee[i].b >> ee[i].c;
    --ee[i].a, --ee[i].b;
    append(ee[i].a, i);
  }
  for (i = n - 1; i < n + n - 2; ++i) {
    cin >> ee[i].a >> ee[i].b >> ee[i].c;
    --ee[i].a, --ee[i].b;
    up[ee[i].a] = i;
  }
  dfs(0, 0);
  while (q--) {
    int t, a, b;
    cin >> t >> a >> b;
    if (t == 1) {
      --a;
      if (a < n - 1) {
        int j = ee[a].b;
        update(tin[j], tout[j], b - ee[a].c);
        ee[a].c = b;
      } else {
        int j = ee[a].a;
        update(tin[j], tin[j], b - ee[a].c);
        ee[a].c = b;
      }
    } else {
      --a, --b;
      if (anc(a, b)) {
        cout << getDist(b) - getDist(a) << '\n';
      } else {
        long long qq = query(tin[a], tout[a]) - getDist(a) + getDist(b);
        cout << qq << '\n';
      }
    }
  }
  for (i = 0; i < n; ++i) free(aa[i]);
}
