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 double PI = acos(-1);
using namespace std;
const int MAX = 2 * (200 * 1000 + 10), MAXLG = 20;
vector<int> E[MAX];
int Forward[MAX], back[MAX], n;
int fr[MAX], to[MAX], weight[MAX];
int siz[MAX], dfs_in[MAX], dfs_out[MAX], dfs_time;
int parent[MAX][MAXLG], depth[MAX];
long long A[MAX], B[MAX];
long long ST[2][MAX << 2], LA[2][MAX << 2];
void dfs(int u, int p, long long w) {
  A[dfs_time] = w;
  B[dfs_time] = w + back[u];
  dfs_in[u] = dfs_time++;
  siz[u] = 1;
  depth[u] = depth[p] + 1;
  parent[u][0] = p;
  for (int k = 0; k < (MAXLG - 1); k++)
    parent[u][k + 1] = parent[parent[u][k]][k];
  for (int e : E[u]) {
    int v = fr[e] + to[e] - u;
    if (v == p) continue;
    assert(to[e] == v);
    dfs(v, u, w + weight[e]);
    siz[v] += siz[u];
  }
  dfs_out[u] = dfs_time - 1;
}
void build(int node, int s, int e, long long *A, long long *ST) {
  if (s == e) {
    ST[node] = A[s];
    return;
  }
  int m = (s + e) >> 1, left = node << 1, right = left | 1;
  build(left, s, m, A, ST);
  build(right, m + 1, e, A, ST);
  ST[node] = min(ST[left], ST[right]);
}
void update(int node, long long v, long long *ST, long long *LA) {
  ST[node] += v;
  LA[node] += v;
}
void push(int node, long long *ST, long long *LA) {
  if (!LA[node]) return;
  int left = node << 1, right = left | 1;
  update(left, LA[node], ST, LA);
  update(right, LA[node], ST, LA);
  LA[node] = 0;
}
void update(int node, int s, int e, int l, int r, long long v, long long *ST,
            long long *LA) {
  if (l <= s && e <= r) return update(node, v, ST, LA);
  push(node, ST, LA);
  int m = (s + e) >> 1, left = node << 1, right = left | 1;
  if (r <= m)
    update(left, s, m, l, r, v, ST, LA);
  else if (m < l)
    update(right, m + 1, e, l, r, v, ST, LA);
  else
    update(left, s, m, l, m, v, ST, LA),
        update(right, m + 1, e, m + 1, r, v, ST, LA);
  ST[node] = min(ST[left], ST[right]);
}
bool inSubTree(int a, int b) {
  return dfs_in[b] <= dfs_in[a] && dfs_in[a] <= dfs_out[b];
}
int lca(int a, int b) {
  if (depth[a] > depth[b]) swap(a, b);
  if (inSubTree(b, a)) return a;
  int k = MAXLG - 1;
  while (a != b) {
    if (depth[a] > depth[b]) swap(a, b);
    while (k && inSubTree(a, parent[b][k])) k--;
    b = parent[b][k];
  }
  return a;
}
long long query(int node, int s, int e, int pos, long long *ST, long long *LA) {
  if (s == e) return ST[node];
  push(node, ST, LA);
  int m = (s + e) >> 1, left = node << 1, right = left | 1;
  if (pos <= m)
    return query(left, s, m, pos, ST, LA);
  else
    return query(right, m + 1, e, pos, ST, LA);
}
long long query(int node, int s, int e, int l, int r, long long *ST,
                long long *LA) {
  if (l <= s && e <= r) return ST[node];
  int m = (s + e) >> 1, left = node << 1, right = left | 1;
  push(node, ST, LA);
  if (r <= m) return query(left, s, m, l, r, ST, LA);
  if (m < l) return query(right, m + 1, e, l, r, ST, LA);
  return min(query(left, s, m, l, m, ST, LA),
             query(right, m + 1, e, m + 1, r, ST, LA));
}
int main() {
  int q;
  scanf("%d %d", &n, &q);
  for (int e = (1); e <= (n - 1); e++) {
    scanf("%d %d %d", fr + e, to + e, weight + e);
    E[fr[e]].push_back(e);
    Forward[to[e]] = weight[e];
  }
  for (int e = (n); e <= (2 * n - 2); e++) {
    scanf("%d %d %d", fr + e, to + e, weight + e);
    assert(to[e] == 1);
    back[fr[e]] = weight[e];
  }
  dfs(1, 0, 0);
  dfs_out[0] = n;
  build(1, 0, n - 1, A, ST[0]);
  build(1, 0, n - 1, B, ST[1]);
  for (int i = 0; i < (q); i++) {
    int type, a, b;
    scanf("%d %d %d", &type, &a, &b);
    if (type == 1) {
      int e = a;
      long long diff = b - weight[e];
      weight[e] = b;
      if (e < n) {
        int u = to[e], l = dfs_in[u], r = dfs_out[u];
        update(1, 0, n - 1, l, r, diff, ST[0], LA[0]);
        update(1, 0, n - 1, l, r, diff, ST[1], LA[1]);
      } else {
        int u = fr[e], pos = dfs_in[u];
        update(1, 0, n - 1, pos, pos, diff, ST[1], LA[1]);
      }
    } else {
      int p = lca(a, b);
      if (p == a) {
        int l = dfs_in[a], r = dfs_in[b];
        long long tb = query(1, 0, n - 1, r, ST[0], LA[0]);
        long long ta = query(1, 0, n - 1, l, ST[0], LA[0]);
        printf("%lld\n", tb - ta);
      } else {
        long long x = query(1, 0, n - 1, dfs_in[a], dfs_out[a], ST[1], LA[1]),
                  y = query(1, 0, n - 1, dfs_in[a], ST[0], LA[0]);
        long long up = x - y;
        long long down = query(1, 0, n - 1, dfs_in[b], ST[0], LA[0]);
        printf("%lld\n", up + down);
      }
    }
  }
  return 0;
}
