#include <bits/stdc++.h>
using namespace std;
inline int min(int a, int b) { return a < b ? a : b; }
inline int read() {
  int s = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
  return s * f;
}
const int maxn = 8e5 + 10;
int n, q, tot, head[maxn], xx[maxn << 1], yy[maxn << 1];
struct data {
  int to, next, w;
} edge[maxn << 1];
int fa[maxn], sz[maxn], top[maxn], dep[maxn], son[maxn];
int seg[maxn << 2], w[maxn], ww[maxn];
int id[maxn], cnt, bian[maxn], num[maxn], ANS, d[maxn];
int LCA(int x, int y) {
  while (top[x] != top[y]) {
    if (dep[top[x]] < dep[top[y]]) swap(x, y);
    x = fa[top[x]];
  }
  if (dep[x] > dep[y]) swap(x, y);
  return x;
}
inline void pushup(int rt) { seg[rt] = seg[rt << 1] + seg[rt << 1 | 1]; }
void change(int rt, int lb, int rb, int kkk, int k) {
  if (kkk > rb || kkk < lb) return;
  if (lb == rb) {
    seg[rt] = k;
    return;
  }
  int mid = (lb + rb) >> 1;
  change(rt << 1, lb, mid, kkk, k), change(rt << 1 | 1, mid + 1, rb, kkk, k);
  pushup(rt);
}
int ask(int rt, int lb, int rb, int l, int r) {
  if (lb > r || l > rb) return 0;
  if (l <= lb && r >= rb) return seg[rt];
  int mid = (lb + rb) >> 1;
  return ask(rt << 1, lb, mid, l, r) + ask(rt << 1 | 1, mid + 1, rb, l, r);
}
void built(int rt, int lb, int rb) {
  if (lb == rb) {
    seg[rt] = w[lb];
    return;
  }
  int mid = (lb + rb) >> 1;
  built(rt << 1, lb, mid), built(rt << 1 | 1, mid + 1, rb);
  pushup(rt);
}
void dfs1(int x, int f, int Dep) {
  dep[x] = Dep;
  sz[x] = 1;
  fa[x] = f;
  int maxs = -1;
  for (int i = head[x]; i; i = edge[i].next) {
    int y = edge[i].to;
    dfs1(y, x, Dep + 1);
    sz[x] += sz[y];
    ww[y] = edge[i].w;
    if (sz[y] > maxs) maxs = sz[y], son[x] = y;
  }
}
void dfs2(int x, int Top) {
  top[x] = Top;
  id[x] = ++cnt;
  w[cnt] = ww[x];
  if (!son[x]) return;
  dfs2(son[x], Top);
  for (int i = head[x]; i; i = edge[i].next) {
    int y = edge[i].to;
    if (y == son[x]) continue;
    dfs2(y, y);
  }
}
int querysum(int x, int y) {
  int ans = 0;
  while (top[x] != top[y]) {
    if (dep[top[x]] < dep[top[y]]) swap(x, y);
    ans += ask(1, 1, n, id[top[x]], id[x]);
    x = fa[top[x]];
  }
  if (dep[x] > dep[y]) swap(x, y);
  if (x != y) ans += ask(1, 1, n, id[x] + 1, id[y]);
  return ans;
}
void dfsk(int x) {
  d[x] = bian[x];
  for (int i = head[x]; i; i = edge[i].next) {
    int y = edge[i].to;
    dfsk(y);
    d[x] = min(d[x], min(edge[i].w + bian[y], edge[i].w + d[y]));
  }
}
int query(int x, int y) {
  int k = LCA(x, y);
  if (k == x)
    return querysum(x, y);
  else {
    dfsk(x);
    return querysum(1, y) + min(bian[x], d[x]);
  }
}
inline void make(int u, int v, int w) {
  edge[++tot] = (data){v, head[u], w};
  head[u] = tot;
}
int main() {
  n = read(), q = read();
  for (int i = 1; i < n; i++) {
    xx[i] = read(), yy[i] = read();
    int z = read();
    make(xx[i], yy[i], z);
  }
  for (int i = 1; i < n; i++) {
    int x = read(), y = read(), z = read();
    num[n - 1 + i] = max(x, y);
    bian[max(x, y)] = z;
  }
  dfs1(1, 0, 1);
  dfs2(1, 1);
  built(1, 1, n);
  for (int i = 1; i <= q; i++) {
    int opt = read(), x = read(), y = read();
    if (opt == 1) {
      if (x > n - 1)
        bian[num[x]] = y;
      else {
        change(1, 1, n, id[edge[x].to], y);
        edge[x].w = y;
      }
    }
    if (opt == 2) printf("%d\n", query(x, y));
  }
  return 0;
}
