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 n, q, timer, ai, bi, ci;
vector<vector<long long> > data;
vector<vector<long long> > money;
vector<long long> tin, tout, first, second, line, rmq, values, pushs, now;
vector<pair<long long, long long> > edges;
void dfs(long long vertex, long long dist) {
  tin[vertex] = timer;
  timer++;
  line.push_back(dist + values[vertex]);
  first[vertex] = line.size() - 1;
  for (long long i = 0; i < data[vertex].size(); i++) {
    long long to = data[vertex][i];
    dfs(to, dist + money[vertex][i]);
  }
  tout[vertex] = timer;
  timer++;
  line.push_back(dist + values[vertex]);
  second[vertex] = line.size() - 1;
}
void create(long long i, long long l, long long r) {
  if (r - l == 1) {
    rmq[i] = line[l];
    return;
  }
  long long mid = (l + r) / 2;
  create(2 * i + 1, l, mid);
  create(2 * i + 2, mid, r);
  rmq[i] = min(rmq[2 * i + 1], rmq[2 * i + 2]);
}
void push(long long i, long long l, long long r) {
  if (l + 1 >= r) return;
  long long p = pushs[i];
  rmq[2 * i + 1] += p;
  rmq[2 * i + 2] += p;
  pushs[2 * i + 1] += p;
  pushs[2 * i + 2] += p;
  pushs[i] = 0;
}
long long get(long long i, long long l, long long r, long long ind) {
  push(i, l, r);
  if (r - l == 1) {
    return rmq[i];
  }
  long long mid = (l + r) / 2;
  if (ind < mid)
    return get(2 * i + 1, l, mid, ind);
  else
    return get(2 * i + 2, mid, r, ind);
}
long long get_big(long long i, long long l, long long r, long long l1,
                  long long r1) {
  push(i, l, r);
  if (l1 >= r1) return 1e12;
  if (l1 == l && r1 == r) {
    return rmq[i];
  }
  long long mid = (l + r) / 2;
  return min(get_big(2 * i + 1, l, mid, l1, min(r1, mid)),
             get_big(2 * i + 2, mid, r, max(l1, mid), r1));
}
void change(long long i, long long l, long long r, long long l1, long long r1,
            long long vv) {
  push(i, l, r);
  if (l1 >= r1) return;
  if (l == l1 && r == r1) {
    rmq[i] += vv;
    pushs[i] += vv;
    return;
  }
  long long mid = (l + r) / 2;
  change(2 * i + 1, l, mid, l1, min(r1, mid), vv);
  change(2 * i + 2, mid, r, max(l1, mid), r1, vv);
  rmq[i] = min(rmq[2 * i + 1], rmq[2 * i + 2]);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> q;
  for (long long i = 0; i < n; i++) {
    vector<long long> h1, h2;
    data.push_back(h1);
    money.push_back(h2);
    tin.push_back(0);
    tout.push_back(0);
    first.push_back(0);
    second.push_back(0);
    values.push_back(0);
  }
  for (long long i = 0; i < n - 1; i++) {
    cin >> ai >> bi >> ci;
    edges.push_back(make_pair(ai, bi));
    now.push_back(ci);
    data[ai - 1].push_back(bi - 1);
    money[ai - 1].push_back(ci);
  }
  for (long long i = 0; i < n - 1; i++) {
    cin >> ai >> bi >> ci;
    edges.push_back(make_pair(ai, bi));
    now.push_back(ci);
    values[ai - 1] = ci;
  }
  timer = 0;
  dfs(0, 0);
  long long sz = 2 * n;
  for (long long i = 0; i < 4 * sz; i++) {
    rmq.push_back(0);
    pushs.push_back(0);
  }
  create(0, 0, sz);
  for (long long i = 0; i < q; i++) {
    long long t;
    cin >> t;
    if (t == 2) {
      cin >> ai >> bi;
      ai--;
      bi--;
      if (tin[ai] <= tin[bi] && tout[ai] >= tout[bi]) {
        cout << get(0, 0, sz, first[bi]) - get(0, 0, sz, first[ai]) -
                    values[bi] + values[ai]
             << endl;
      } else {
        long long r1 = get_big(0, 0, sz, first[ai], second[ai] + 1);
        r1 -= get(0, 0, sz, first[ai]);
        r1 += values[ai];
        r1 += get(0, 0, sz, first[bi]);
        r1 -= values[bi];
        cout << r1 << endl;
      }
    } else {
      cin >> ai >> ci;
      if (ai < n) {
        long long v = edges[ai - 1].second - 1;
        long long diff = ci - now[ai - 1];
        change(0, 0, sz, first[v], second[v] + 1, diff);
        now[ai - 1] = ci;
      } else {
        long long v = edges[ai - 1].first - 1;
        long long diff = ci - values[v];
        values[v] = ci;
        change(0, 0, sz, first[v], first[v] + 1, diff);
        change(0, 0, sz, second[v], second[v] + 1, diff);
      }
    }
  }
  return 0;
}
