Problem: 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

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int n, m, num, N, head[800010], p1[800010], p2[800010], c[800010], dep[800010],
    fa[800010][25];
long long s[800010], b[800010];
struct edge {
  int u, v, t;
} E[800010];
struct node {
  int v, pre, t;
} e[800010];
void Add(int from, int to, int dis) {
  num++;
  e[num].v = to;
  e[num].t = dis;
  e[num].pre = head[from];
  head[from] = num;
}
void Up(int k) {
  b[k * 2] += b[k];
  b[k * 2 + 1] += b[k];
  s[k * 2] += b[k];
  s[k * 2 + 1] += b[k];
  b[k] = 0;
}
void Insert(int k, int l, int r, int x, int y, long long z) {
  if (x <= l && y >= r) {
    s[k] += z;
    b[k] += z;
    return;
  }
  if (b[k]) Up(k);
  if (x <= (l + r) / 2) Insert(k * 2, l, (l + r) / 2, x, y, z);
  if (y > (l + r) / 2) Insert(k * 2 + 1, (l + r) / 2 + 1, r, x, y, z);
  s[k] = min(s[k * 2], s[k * 2 + 1]);
}
long long Query(int k, int l, int r, int x, int y) {
  if (x <= l && y >= r) return s[k];
  long long res = 1e15;
  if (b[k]) Up(k);
  if (x <= (l + r) / 2) res = min(res, Query(k * 2, l, (l + r) / 2, x, y));
  if (y > (l + r) / 2)
    res = min(res, Query(k * 2 + 1, (l + r) / 2 + 1, r, x, y));
  return res;
}
void Dfs(int now, int from, int deep, long long ds) {
  p1[now] = ++N;
  Insert(1, 1, n, N, N, ds + c[now]);
  dep[now] = deep;
  fa[now][0] = from;
  for (int i = head[now]; i; i = e[i].pre) {
    int v = e[i].v;
    if (v == from) continue;
    Dfs(v, now, deep + 1, ds + e[i].t);
  }
  p2[now] = N;
}
void Get() {
  for (int j = 1; j <= 20; j++)
    for (int i = 1; i <= n; i++) fa[i][j] = fa[fa[i][j - 1]][j - 1];
}
int LCA(int x, int y) {
  if (dep[x] < dep[y]) swap(x, y);
  int t = dep[x] - dep[y];
  for (int i = 0; i <= 20; i++)
    if (t & (1 << i)) x = fa[x][i];
  if (x == y) return x;
  for (int i = 20; i >= 0; i--)
    if (fa[x][i] != fa[y][i]) {
      x = fa[x][i];
      y = fa[y][i];
    }
  return fa[x][0];
}
int main() {
  scanf("%d%d", &n, &m);
  num = 0;
  N = 0;
  int u, v, t;
  for (int i = 1; i < n; i++) {
    scanf("%d%d%d", &u, &v, &t);
    Add(u, v, t);
    E[i].u = u;
    E[i].v = v;
    E[i].t = t;
  }
  for (int i = 1; i < n; i++) {
    scanf("%d%d%d", &E[i + n - 1].u, &E[i + n - 1].v, &E[i + n - 1].t);
    c[E[i + n - 1].u] = E[i + n - 1].t;
  }
  Dfs(1, 0, 0, 0);
  Get();
  int x, y, z, anc;
  long long A, B, C;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d%d", &x, &y, &z);
    if (x == 2) {
      anc = LCA(y, z);
      if (anc == y) {
        A = Query(1, 1, n, p1[y], p1[y]) - c[y];
        B = Query(1, 1, n, p1[z], p1[z]) - c[z];
        printf("%lld\n", B - A);
      } else {
        A = Query(1, 1, n, p1[y], p2[y]);
        B = Query(1, 1, n, p1[y], p1[y]) - c[y];
        C = Query(1, 1, n, p1[z], p1[z]) - c[z];
        printf("%lld\n", A - B + C);
      }
    } else {
      if (y >= n) {
        Insert(1, 1, n, p1[E[y].u], p1[E[y].u], z - c[E[y].u]);
        c[E[y].u] = z;
      } else {
        Insert(1, 1, n, p1[E[y].v], p2[E[y].v], z - E[y].t);
        E[y].t = z;
      }
    }
  }
  return 0;
}