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 MM = 2e5 + 5, MOD = 1e9 + 7;
long long N, M, bit[MM], bk[MM], sb[MM], in[MM], ot[MM], ct;
vector<pair<long long, long long>> edg;
vector<long long> adj[MM];
struct node {
  long long l, r, v, lz;
} seg[4 * MM];
void calc(long long i) { seg[i].v = min(seg[2 * i].v, seg[2 * i + 1].v); }
void prop(long long i) {
  seg[i].v += seg[i].lz;
  if (seg[i].l != seg[i].r) {
    seg[2 * i].lz += seg[i].lz;
    seg[2 * i + 1].lz += seg[i].lz;
  }
  seg[i].lz = 0;
}
void build(long long l, long long r, long long i) {
  seg[i].l = l;
  seg[i].r = r;
  if (l == r) return;
  long long m = (l + r) / 2;
  build(l, m, 2 * i);
  build(m + 1, r, 2 * i + 1);
}
void upd(long long l, long long r, long long v, long long i = 1) {
  prop(i);
  if (seg[i].l > r || seg[i].r < l) return;
  if (seg[i].l >= l && seg[i].r <= r) {
    seg[i].lz += v;
    prop(i);
    return;
  }
  upd(l, r, v, 2 * i);
  upd(l, r, v, 2 * i + 1);
  calc(i);
}
long long qry(long long l, long long r, long long i = 1) {
  prop(i);
  if (seg[i].l > r || seg[i].r < l) return 1e18;
  if (seg[i].l >= l && seg[i].r <= r) return seg[i].v;
  return min(qry(l, r, 2 * i), qry(l, r, 2 * i + 1));
}
void upd(long long idx, long long v) {
  if (idx == 0) return;
  for (; idx < MM; idx += idx & -idx) bit[idx] += v;
}
long long qry(long long idx) {
  long long ret = 0;
  for (; idx > 0; idx -= idx & -idx) ret += bit[idx];
  return ret;
}
void dfs(long long u, long long pa) {
  in[u] = ++ct;
  for (long long v : adj[u]) {
    if (v == pa) continue;
    dfs(v, u);
    upd(in[v], sb[v]);
    upd(ot[v] + 1, -sb[v]);
    upd(in[v], in[v], bk[v]);
    upd(in[v], ot[v], sb[v]);
  }
  ot[u] = ct;
}
bool anc(long long u, long long v) { return in[u] <= in[v] && ot[v] <= ot[u]; }
signed main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  cin >> N >> M;
  for (long long i = 1, u, v, w; i < (N << 1) - 1; ++i) {
    cin >> u >> v >> w;
    if (i >= N) {
      bk[u] = w;
    } else {
      adj[u].push_back(v);
      sb[v] = w;
    }
    edg.emplace_back(u, v);
  }
  build(1, N, 1);
  dfs(1, 0);
  for (long long i = 1, op, x, y; i <= M; ++i) {
    cin >> op >> x >> y;
    if (op == 1) {
      if (x >= N) {
        --x;
        upd(in[edg[x].first], in[edg[x].first], y - bk[edg[x].first]);
        bk[edg[x].first] = y;
      } else {
        --x;
        upd(in[edg[x].second], y - sb[edg[x].second]);
        upd(ot[edg[x].second] + 1, (-1 * y) - (-1 * sb[edg[x].second]));
        upd(in[edg[x].second], ot[edg[x].second], y - sb[edg[x].second]);
        sb[edg[x].second] = y;
      }
    } else {
      if (anc(x, y)) {
        cout << qry(in[y]) - qry(in[x]) << "\n";
      } else {
        long long bst = qry(in[x], ot[x]) - qry(in[x]);
        cout << bst + qry(in[y]) << "\n";
      }
    }
  }
}
