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;
struct node {
  int q, p, lazy;
  void merge(struct node &l, struct node &r) { q = min(l.q, r.q); }
};
struct edge_ {
  int a, b, c;
};
int TIME;
int sr[200010], en[200010], dist[200010];
bool visit[200010];
void lazy(struct node *st, int si, int ss, int se) {
  if (st[si].lazy == 0) return;
  st[si].q += st[si].lazy;
  st[si].p += st[si].lazy;
  if (ss != se) {
    st[si * 2 + 1].lazy += st[si].lazy;
    st[si * 2 + 2].lazy += st[si].lazy;
  }
  st[si].lazy = 0;
}
void update1(struct node *st, int ss, int se, int us, int ue, int si, int val) {
  lazy(st, si, ss, se);
  if (ss > se || ss > ue || se < us) return;
  if (ss >= us && se <= ue) {
    st[si].q += val;
    st[si].p += val;
    if (ss != se) {
      st[si * 2 + 1].lazy += val;
      st[si * 2 + 2].lazy += val;
    }
    return;
  }
  int mid = ss + (se - ss) / 2;
  update1(st, ss, mid, us, ue, 2 * si + 1, val);
  update1(st, mid + 1, se, us, ue, 2 * si + 2, val);
  st[si].merge(st[2 * si + 1], st[2 * si + 2]);
}
void update2(struct node *st, int ss, int se, int index, int si, int val) {
  lazy(st, si, ss, se);
  if (ss > index || se < index) return;
  if (ss == se) {
    st[si].q += val;
    return;
  }
  int mid = ss + (se - ss) / 2;
  update2(st, ss, mid, index, 2 * si + 1, val);
  update2(st, mid + 1, se, index, 2 * si + 2, val);
  st[si].merge(st[2 * si + 1], st[2 * si + 2]);
}
struct node query1(struct node *st, int ss, int se, int index, int si) {
  struct node result;
  lazy(st, si, ss, se);
  if (ss == se) return st[si];
  int mid = ss + (se - ss) / 2;
  if (index > mid) return query1(st, mid + 1, se, index, 2 * si + 2);
  if (index <= mid) return query1(st, ss, mid, index, 2 * si + 1);
}
struct node query2(struct node *st, int ss, int se, int qs, int qe, int si) {
  struct node result;
  lazy(st, si, ss, se);
  if (ss >= qs && se <= qe) return st[si];
  int mid = ss + (se - ss) / 2;
  if (qs > mid) return query2(st, mid + 1, se, qs, qe, 2 * si + 2);
  if (qe <= mid) return query2(st, ss, mid, qs, qe, 2 * si + 1);
  struct node l = query2(st, ss, mid, qs, qe, 2 * si + 1);
  struct node r = query2(st, mid + 1, se, qs, qe, 2 * si + 2);
  result.merge(l, r);
  return result;
}
void constructSTUtil(struct node *st, int ss, int se, int si) {
  if (ss > se) return;
  if (ss == se) {
    st[si].p = 0;
    st[si].q = 0;
    st[si].lazy = 0;
    return;
  }
  int mid = (ss + se) / 2;
  constructSTUtil(st, ss, mid, si * 2 + 1);
  constructSTUtil(st, mid + 1, se, si * 2 + 2);
  st[si].merge(st[si * 2 + 1], st[si * 2 + 2]);
  st[si].lazy = 0;
}
struct node *constructST(int n) {
  int x = (int)(ceil(log2(n)));
  int size = 2 * pow(2, x) - 1;
  struct node *st = new struct node[size];
  constructSTUtil(st, 0, n - 1, 0);
  return st;
}
void dfs(vector<int> v[], int n = 0, int d = 0) {
  visit[n] = true;
  sr[n] = TIME;
  TIME++;
  dist[n] = d;
  for (int i = 0; i < v[n].size(); i++) {
    int k = v[n][i];
    if (visit[k]) continue;
    dfs(v, k, d + 1);
  }
  en[n] = TIME - 1;
}
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  vector<int> v[n];
  struct edge_ edge[2 * n];
  for (int i = 0; i < 2 * n - 2; i++) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    a--, b--;
    edge[i].a = a, edge[i].b = b, edge[i].c = c;
    v[a].push_back(b);
  }
  TIME = 0;
  memset(visit, false, sizeof visit);
  dfs(v);
  struct node *st = constructST(n);
  for (int i = 0; i < (2 * n - 2); i++) {
    if (i < (n - 1))
      update1(st, 0, n - 1, sr[edge[i].b], en[edge[i].b], 0, edge[i].c);
    else
      update2(st, 0, n - 1, sr[edge[i].a], 0, edge[i].c);
  }
  while (q--) {
    int a, i, w;
    scanf("%d%d%d", &a, &i, &w);
    if (a == 1) {
      i--;
      if (i < (n - 1))
        update1(st, 0, n - 1, sr[edge[i].b], en[edge[i].b], 0, w - edge[i].c);
      else
        update2(st, 0, n - 1, sr[edge[i].a], 0, w - edge[i].c);
      edge[i].c = w;
    } else {
      int u = i, v = w;
      u--, v--;
      if (sr[u] <= sr[v] && en[u] >= en[v])
        printf("%d\n", query1(st, 0, n - 1, sr[v], 0).p -
                           query1(st, 0, n - 1, sr[u], 0).p);
      else
        printf("%d\n", query1(st, 0, n - 1, sr[v], 0).p +
                           query2(st, 0, n - 1, sr[u], en[u], 0).q -
                           query1(st, 0, n - 1, sr[u], 0).p);
    }
  }
  return 0;
}
