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;
const double EPS = 1e-10;
const long long INF = 1e18;
const int N = 4e5 + 1000;
struct node {
  int v, c, w;
};
struct segtree {
  int l, r, a, b;
  long long w, c;
} f[N * 2];
int n, m, tim, t;
vector<node> g[N];
int dep[N], p[N][20], l[N], r[N], pre[N], d[N];
long long val[N], dis[N], a[N], c[N];
void push_down(int p) {
  if (f[p].c == 0) return;
  f[f[p].l].w += f[p].c;
  f[f[p].r].w += f[p].c;
  f[f[p].l].c += f[p].c;
  f[f[p].r].c += f[p].c;
  f[p].c = 0;
  return;
}
void build(int p, int a, int b) {
  f[p].a = a;
  f[p].b = b;
  f[p].c = 0;
  if (a + 1 == b) {
    f[p].w = dis[d[a]] + c[d[a]];
    return;
  }
  int m = (a + b) / 2;
  t++;
  f[p].l = t;
  build(t, a, m);
  t++;
  f[p].r = t;
  build(t, m, b);
  f[p].w = min(f[f[p].l].w, f[f[p].r].w);
  return;
}
void Insert(int p, int x, int y, int z) {
  if (x <= f[p].a && y >= f[p].b - 1) {
    f[p].w += z;
    f[p].c += z;
    return;
  }
  push_down(p);
  int m = (f[p].a + f[p].b) / 2;
  if (x < m) Insert(f[p].l, x, y, z);
  if (y >= m) Insert(f[p].r, x, y, z);
  f[p].w = min(f[f[p].l].w, f[f[p].r].w);
  return;
}
long long Query(int p, int x, int y) {
  long long ans = INF;
  if (x <= f[p].a && y >= f[p].b - 1) {
    return f[p].w;
  }
  push_down(p);
  int m = (f[p].a + f[p].b) / 2;
  if (x < m) ans = min(ans, Query(f[p].l, x, y));
  if (y >= m) ans = min(ans, Query(f[p].r, x, y));
  return ans;
}
void dfs(int u, int value, int deep, int fa) {
  l[u] = ++tim;
  dis[u] = value;
  dep[u] = deep;
  p[u][0] = fa;
  d[tim] = u;
  for (int i = 1; i < 20; i++) p[u][i] = p[p[u][i - 1]][i - 1];
  for (int i = 0; i < g[u].size(); i++) {
    pre[g[u][i].c] = g[u][i].v;
    val[g[u][i].v] = g[u][i].w;
    dfs(g[u][i].v, value + g[u][i].w, deep + 1, u);
  }
  r[u] = tim;
  return;
}
int lca(int x, int y) {
  if (dep[x] < dep[y]) swap(x, y);
  for (int i = 19; i > -1; i--)
    if (dep[p[x][i]] >= dep[y]) x = p[x][i];
  if (x == y) return x;
  for (int i = 19; i > -1; i--)
    if (p[x][i] != p[y][i]) {
      x = p[x][i];
      y = p[y][i];
    }
  return p[x][0];
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i < n; i++) {
    int x, y;
    long long z;
    scanf("%d%d%I64d", &x, &y, &z);
    node e;
    e.v = y;
    e.c = i;
    e.w = z;
    g[x].push_back(e);
  }
  for (int i = 1; i < n; i++) {
    int x, y;
    long long z;
    scanf("%d%d%I64d", &x, &y, &z);
    c[x] = z;
    a[i] = x;
  }
  tim = 0;
  c[1] = 0;
  dfs(1, 0, 1, 0);
  t = 1;
  build(1, 1, n + 1);
  while (m--) {
    int op, x;
    long long y;
    scanf("%d", &op);
    if (op == 1) {
      scanf("%d%I64d", &x, &y);
      if (x < n) {
        x = pre[x];
        Insert(1, l[x], r[x], y - val[x]);
        val[x] = y;
      } else {
        x = a[x - n + 1];
        Insert(1, l[x], l[x], y - c[x]);
        c[x] = y;
      }
    } else {
      scanf("%d%I64d", &x, &y);
      int k = lca(x, y);
      long long ans;
      if (k == x) {
        ans = Query(1, l[y], l[y]) - Query(1, l[x], l[x]) + c[x] - c[y];
      } else {
        ans = Query(1, l[x], r[x]);
        long long dx = Query(1, l[x], l[x]) - c[x];
        long long dy = Query(1, l[y], l[y]) - c[y];
        ans = ans - dx + dy;
      }
      printf("%I64d\n", ans);
    }
  }
  return 0;
}