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;
long long int n, q, tin[200005], tout[200005], timer, par[200005];
long long int a[200005], b[200005];
vector<pair<long long int, long long int> > g[200005];
long long int which[400005];
pair<pair<long long int, long long int>, long long int> ed[400005];
void dfs(long long int st, long long int pr, long long int wt,
         long long int totwt) {
  tin[st] = ++timer;
  which[timer] = st;
  totwt += wt;
  par[st] = pr;
  a[st] = wt;
  b[st] += totwt;
  for (pair<long long int, long long int> xp : g[st])
    if (xp.first != 1) dfs(xp.first, st, xp.second, totwt);
  tout[st] = ++timer;
  which[timer] = -st;
  totwt -= wt;
}
long long int seg1[2000001], seg2[2000001], pen2[2000001];
void build1(long long int idx, long long int lo, long long int hi) {
  if (lo == hi) {
    if (which[lo] < 0)
      seg1[idx] = -a[-which[lo]];
    else
      seg1[idx] = a[which[lo]];
    return;
  }
  long long int mid = (lo + hi) / 2;
  build1(2 * idx, lo, mid);
  build1(2 * idx + 1, mid + 1, hi);
  seg1[idx] = seg1[2 * idx] + seg1[2 * idx + 1];
}
void update1(long long int idx, long long int lo, long long int hi,
             long long int pos, long long int val) {
  if (lo == hi) {
    seg1[idx] = val;
    return;
  }
  long long int mid = (lo + hi) / 2;
  if (pos <= mid)
    update1(2 * idx, lo, mid, pos, val);
  else
    update1(2 * idx + 1, mid + 1, hi, pos, val);
  seg1[idx] = seg1[2 * idx] + seg1[2 * idx + 1];
}
long long int query1(long long int idx, long long int lo, long long int hi,
                     long long int st, long long int en) {
  if (st == lo && hi == en) return seg1[idx];
  long long int mid = (lo + hi) / 2;
  if (en <= mid) return query1(2 * idx, lo, mid, st, en);
  if (st > mid) return query1(2 * idx + 1, mid + 1, hi, st, en);
  return query1(2 * idx, lo, mid, st, mid) +
         query1(2 * idx + 1, mid + 1, hi, mid + 1, en);
}
void build2(long long int idx, long long int lo, long long int hi) {
  if (lo == hi) {
    seg2[idx] = b[abs(which[lo])];
    return;
  }
  long long int mid = (lo + hi) / 2;
  build2(2 * idx, lo, mid);
  build2(2 * idx + 1, mid + 1, hi);
  seg2[idx] = min(seg2[2 * idx], seg2[2 * idx + 1]);
}
void lazyprop2(long long int idx) {
  seg2[idx] += pen2[idx];
  pen2[2 * idx] += pen2[idx];
  pen2[2 * idx + 1] += pen2[idx];
  pen2[idx] = 0;
}
void update2(long long int idx, long long int lo, long long int hi,
             long long int st, long long int en, long long int val) {
  if (lo == st && hi == en) {
    if (lo == hi)
      seg2[idx] += val;
    else
      pen2[idx] += val;
    return;
  }
  if (pen2[idx]) lazyprop2(idx);
  long long int mid = (lo + hi) / 2;
  if (en <= mid)
    update2(2 * idx, lo, mid, st, en, val);
  else if (st > mid)
    update2(2 * idx + 1, mid + 1, hi, st, en, val);
  else {
    update2(2 * idx, lo, mid, st, mid, val);
    update2(2 * idx + 1, mid + 1, hi, mid + 1, en, val);
  }
  seg2[idx] =
      min(seg2[2 * idx] + pen2[2 * idx], seg2[2 * idx + 1] + pen2[2 * idx + 1]);
}
long long int query2(long long int idx, long long int lo, long long int hi,
                     long long int st, long long int en) {
  if (st == lo && hi == en) return seg2[idx] + pen2[idx];
  if (pen2[idx]) lazyprop2(idx);
  long long int mid = (lo + hi) / 2;
  if (en <= mid) return query2(2 * idx, lo, mid, st, en);
  if (st > mid) return query2(2 * idx + 1, mid + 1, hi, st, en);
  return min(query2(2 * idx, lo, mid, st, mid),
             query2(2 * idx + 1, mid + 1, hi, mid + 1, en));
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> q;
  for (long long int i = 1; i <= 2 * n - 2; ++i) {
    long long int u, v, w;
    cin >> u >> v >> w;
    g[u].push_back({v, w});
    ed[i] = make_pair(make_pair(u, v), w);
    if (v == 1) b[u] = w;
  }
  dfs(1, 1, 0, 0);
  build1(1, 1, 2 * n);
  build2(1, 1, 2 * n);
  while (q--) {
    long long int ty;
    cin >> ty;
    if (ty == 2) {
      long long int u, v;
      cin >> u >> v;
      if (tin[v] >= tin[u] && tout[v] <= tout[u]) {
        cout << query1(1, 1, 2 * n, 1, tin[v]) - query1(1, 1, 2 * n, 1, tin[u])
             << '\n';
      } else
        cout << query2(1, 1, 2 * n, tin[u], tout[u]) +
                    query1(1, 1, 2 * n, 1, tin[v]) -
                    query1(1, 1, 2 * n, 1, tin[u])
             << '\n';
    } else {
      long long int i, w;
      cin >> i >> w;
      if (i <= n - 1) {
        long long int v = ed[i].first.second;
        update1(1, 1, 2 * n, tin[v], w);
        update1(1, 1, 2 * n, tout[v], -w);
        update2(1, 1, 2 * n, tin[v], tout[v], w - ed[i].second);
      } else {
        long long int v = ed[i].first.first;
        update2(1, 1, 2 * n, tin[v], tin[v], w - ed[i].second);
        update2(1, 1, 2 * n, tout[v], tout[v], w - ed[i].second);
      }
      ed[i].second = w;
    }
  }
}
