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 long long INF = 1e17;
const int N = 2e5 + 5;
int n, q, head[N], id[N], ss[N], son[N], cnt, deep[N], par[N][20], num, se[N];
struct node {
  int from, to, nxt;
  long long w;
} edge[N * 2];
long long val[4 * N], d[N], lazy[4 * N];
void init() {
  for (int i = 1; i <= n; i++) head[i] = -1;
  cnt = 1;
  num = 1;
}
void addEdge(int from, int to, long long w) {
  edge[cnt].from = from;
  edge[cnt].to = to;
  edge[cnt].nxt = head[from];
  edge[cnt].w = w;
  head[from] = cnt++;
}
int dfs(int u, int fa, int c, long long len) {
  id[u] = num;
  ss[num++] = u;
  son[u] = 0;
  par[u][0] = fa;
  d[u] = len;
  deep[u] = c;
  int v;
  for (int i = head[u]; i != -1; i = edge[i].nxt) {
    v = edge[i].to;
    if (v == 1) continue;
    son[u] += dfs(v, u, c + 1, len + edge[i].w);
  }
  return son[u] + 1;
}
void build(int k, int lef, int rig) {
  lazy[k] = 0;
  if (lef == rig) {
    val[k] = d[ss[lef]] + edge[se[ss[lef]]].w;
    return;
  }
  int mid = (lef + rig) >> 1;
  build(k << 1, lef, mid);
  build(k << 1 | 1, mid + 1, rig);
  val[k] = min(val[k << 1], val[k << 1 | 1]);
}
void pushDown(int k) {
  if (lazy[k] == 0) return;
  val[k << 1] += lazy[k];
  val[k << 1 | 1] += lazy[k];
  lazy[k << 1] += lazy[k];
  lazy[k << 1 | 1] += lazy[k];
  lazy[k] = 0;
}
long long query(int k, int lef, int rig, int l, int r) {
  if (l <= lef && rig <= r) return val[k];
  int mid = (lef + rig) >> 1;
  pushDown(k);
  long long ans = INF;
  if (l <= mid) ans = min(ans, query(k << 1, lef, mid, l, r));
  if (r > mid) ans = min(ans, query(k << 1 | 1, mid + 1, rig, l, r));
  return ans;
}
void update(int k, int lef, int rig, int l, int r, long long c) {
  if (l <= lef && rig <= r) {
    lazy[k] += c;
    val[k] += c;
    return;
  }
  int mid = (lef + rig) >> 1;
  pushDown(k);
  if (l <= mid) update(k << 1, lef, mid, l, r, c);
  if (r > mid) update(k << 1 | 1, mid + 1, rig, l, r, c);
  val[k] = min(val[k << 1], val[k << 1 | 1]);
}
void calc() {
  for (int i = 1; 1 << i <= n; i++) {
    for (int j = 2; j <= n; j++) {
      if ((1 << i) <= deep[j]) {
        int tt = par[j][i - 1];
        par[j][i] = par[tt][i - 1];
      }
    }
  }
}
bool LCA(int a, int b) {
  if (deep[a] > deep[b]) return false;
  int tmp = deep[b] - deep[a];
  for (int i = 0; 1 << i <= tmp; i++)
    if (tmp >> i & 1) b = par[b][i];
  return a == b;
}
int main() {
  scanf("%d%d", &n, &q);
  init();
  int a, b, c;
  for (int i = 1; i < 2 * n - 1; i++) {
    scanf("%d%d%d", &a, &b, &c);
    addEdge(a, b, c);
    if (i >= n) se[a] = i;
  }
  addEdge(1, 1, 0);
  se[1] = cnt - 1;
  dfs(1, 0, 0, 0LL);
  calc();
  build(1, 1, n);
  while (q--) {
    scanf("%d%d%d", &a, &b, &c);
    if (a == 1) {
      if (b < n) {
        int tt = edge[b].to;
        long long tmp = (long long)c - edge[b].w;
        update(1, 1, n, id[tt], id[tt] + son[tt], tmp);
      } else {
        int tt = edge[b].from;
        long long tmp = (long long)c - edge[b].w;
        update(1, 1, n, id[tt], id[tt], tmp);
      }
      edge[b].w = c;
    } else if (LCA(b, c))
      printf("%lld\n", query(1, 1, n, id[c], id[c]) - edge[se[c]].w -
                           query(1, 1, n, id[b], id[b]) + edge[se[b]].w);
    else
      printf("%lld\n", query(1, 1, n, id[b], id[b] + son[b]) -
                           query(1, 1, n, id[b], id[b]) + edge[se[b]].w +
                           query(1, 1, n, id[c], id[c]) - edge[se[c]].w);
  }
  return 0;
}
