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>
const double Pi = acos(-1.0);
using namespace std;
const int maxN = 400010;
int n, q;
vector<pair<long long, long long> > G[maxN];
map<int, pair<long long, long long> > ei;
long long e1[maxN], ind1[maxN];
long long dist[maxN];
long long st[maxN], disc[maxN], fin[maxN], t;
void dfs(int cur) {
  st[cur] = ++t;
  disc[t] = cur;
  for (int i = 0; i < (int)G[cur].size(); i++) {
    int nxt = G[cur][i].first;
    dist[nxt] = dist[cur] + G[cur][i].second;
    dfs(nxt);
  }
  fin[cur] = t;
}
long long segt[1 << 20], lazy[1 << 20];
void build(int node, int l, int r) {
  if (l == r) {
    segt[node] = dist[disc[l]] + e1[disc[l]];
    return;
  }
  int mid = (l + r) >> 1, nxt = node << 1;
  build(nxt, l, mid);
  build(nxt + 1, mid + 1, r);
  segt[node] = min(segt[nxt], segt[nxt + 1]);
}
void lazyprop(int node, int l, int r) {
  if (!lazy[node]) return;
  segt[node] += lazy[node];
  if (l != r) {
    int nxt = node << 1;
    lazy[nxt] += lazy[node];
    lazy[nxt + 1] += lazy[node];
  }
  lazy[node] = 0;
}
void update(int node, int l, int r, int i, int j, long long val) {
  lazyprop(node, l, r);
  if (l > r || i > r || j < l) return;
  if (i <= l && j >= r) {
    lazy[node] = val;
    lazyprop(node, l, r);
    return;
  }
  int mid = (l + r) >> 1, nxt = node << 1;
  update(nxt, l, mid, i, j, val);
  update(nxt + 1, mid + 1, r, i, j, val);
  segt[node] = min(segt[nxt], segt[nxt + 1]);
}
long long query(int node, int l, int r, int i, int j) {
  if (l > r || i > r || j < l) return LLONG_MAX;
  lazyprop(node, l, r);
  if (i <= l && j >= r) return segt[node];
  int mid = (l + r) >> 1, nxt = node << 1;
  return min(query(nxt, l, mid, i, j), query(nxt + 1, mid + 1, r, i, j));
}
int main(int argc, char** argv) {
  scanf("%d %d", &n, &q);
  int a, b, c;
  for (int i = 0; i < n - 1; i++) {
    scanf("%d %d %d", &a, &b, &c);
    a--;
    b--;
    G[a].push_back(pair<long long, long long>(b, c));
    ei[i] = pair<long long, long long>(a, b);
  }
  dfs(0);
  for (int i = n - 1; i < 2 * n - 2; i++) {
    scanf("%d %d %d", &a, &b, &c);
    a--;
    e1[a] = c;
    ind1[i] = a;
  }
  build(1, 1, n);
  int qi;
  for (int i = 0; i < q; i++) {
    scanf("%d %d %d", &qi, &a, &b);
    if (qi == 1) {
      a--;
      if (a >= n - 1) {
        update(1, 1, n, st[ind1[a]], st[ind1[a]], b - e1[ind1[a]]);
        e1[ind1[a]] = b;
      } else {
        int u = ei[a].first, v = ei[a].second;
        long long d1 = query(1, 1, n, st[u], st[u]) - e1[u],
                  d2 = query(1, 1, n, st[v], st[v]) - e1[v];
        update(1, 1, n, st[v], fin[v], b - d2 + d1);
      }
    } else {
      a--;
      b--;
      long long d1 = query(1, 1, n, st[a], st[a]) - e1[a],
                d2 = query(1, 1, n, st[b], st[b]) - e1[b];
      if (st[a] <= st[b] && fin[a] >= fin[b])
        printf("%lld\n", d2 - d1);
      else {
        int minup = query(1, 1, n, st[a], fin[a]);
        printf("%lld\n", minup - d1 + d2);
      }
    }
  }
  return 0;
}
