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 int maxn = 2e5 + 100;
int n, q, tin[maxn], tout[maxn], timer, v[maxn * 2], u[maxn * 2], w[maxn * 2],
    cur[maxn], up[maxn];
vector<pair<int, long long> > adj[maxn];
long long sum[maxn * 4], lazy[maxn * 4], mn[maxn * 4];
void dfs(int v) {
  tin[v] = timer++;
  for (auto to : adj[v])
    if (to.first != 1) dfs(to.first);
  tout[v] = timer;
}
void upd(int id, int l, int r, long long val) {
  sum[id] += (long long)(r - l) * val;
  mn[id] += val;
  lazy[id] += val;
}
void shift(int id, int l, int r) {
  int mid = (l + r) / 2;
  upd(id * 2, l, mid, lazy[id]);
  upd(id * 2 + 1, mid, r, lazy[id]);
  lazy[id] = 0;
}
void modify(int first, int second, long long val, int id = 1, int l = 0,
            int r = n) {
  if (l >= second || r <= first) return;
  if (l >= first && r <= second) {
    upd(id, l, r, val);
    return;
  }
  shift(id, l, r);
  int mid = (l + r) / 2;
  modify(first, second, val, id * 2, l, mid);
  modify(first, second, val, id * 2 + 1, mid, r);
  sum[id] = sum[id * 2] + sum[id * 2 + 1];
  mn[id] = min(mn[id * 2], mn[id * 2 + 1]);
}
void modify_mn(int pos, int val, int id = 1, int l = 0, int r = n) {
  if (r - l < 2) {
    mn[id] += val;
    return;
  }
  shift(id, l, r);
  int mid = (l + r) / 2;
  if (pos < mid)
    modify_mn(pos, val, id * 2, l, mid);
  else
    modify_mn(pos, val, id * 2 + 1, mid, r);
  mn[id] = min(mn[id * 2], mn[id * 2 + 1]);
}
long long toroot(int pos, int id = 1, int l = 0, int r = n) {
  if (r - l < 2) return sum[id];
  shift(id, l, r);
  int mid = (l + r) / 2;
  if (pos < mid)
    return toroot(pos, id * 2, l, mid);
  else
    return toroot(pos, id * 2 + 1, mid, r);
}
long long get_mn(int first, int second, int id = 1, int l = 0, int r = n) {
  if (l >= second || r <= first) return LLONG_MAX;
  if (l >= first && r <= second) return mn[id];
  int mid = (l + r) / 2;
  shift(id, l, r);
  return min(get_mn(first, second, id * 2, l, mid),
             get_mn(first, second, id * 2 + 1, mid, r));
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0);
  cin >> n >> q;
  for (int i = 1; i <= n * 2 - 2; i++) {
    cin >> v[i] >> u[i] >> w[i];
    adj[v[i]].push_back({u[i], w[i]});
    if (i <= n - 1)
      cur[u[i]] = w[i];
    else
      up[v[i]] = w[i];
  }
  dfs(1);
  for (int i = 2; i <= n; i++) modify(tin[i], tout[i], cur[i]);
  for (int i = 2; i <= n; i++) modify_mn(tin[i], up[i]);
  while (q--) {
    int type, a, b;
    cin >> type >> a >> b;
    if (type == 1) {
      if (a <= n - 1) {
        modify(tin[u[a]], tout[u[a]], b - cur[u[a]]);
        cur[u[a]] = b;
      } else {
        modify_mn(tin[v[a]], b - up[v[a]]);
        up[v[a]] = b;
      }
    } else {
      if (tin[a] <= tin[b] && tout[a] >= tout[b])
        cout << toroot(tin[b]) - toroot(tin[a]) << "\n";
      else
        cout << get_mn(tin[a], tout[a]) - toroot(tin[a]) + toroot(tin[b])
             << "\n";
    }
  }
  return 0;
}
