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 spf[301];
long long fac[301];
void sieve() {
  spf[1] = 1;
  for (long long i = 2; i < 301; i++) spf[i] = i;
  for (long long i = 4; i < 301; i += 2) spf[i] = 2;
  for (long long i = 3; i * i < 301; i++) {
    if (spf[i] == i) {
      for (long long j = i * i; j < 301; j += i)
        if (spf[j] == j) spf[j] = i;
    }
  }
}
map<long long, long long> getfactor(long long a) {
  map<long long, long long> m;
  while (a > 1) {
    m[spf[a]]++;
    a /= spf[a];
  }
  return m;
}
long long power(long long x, long long y, long long p) {
  long long res = 1;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x);
    y = y >> 1;
    x = (x * x);
  }
  return res;
}
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long inverse(long long a, long long p) { return power(a, p - 2, p); }
long long ncr(long long n, long long r, long long p) {
  if (r > n) return 0;
  if (r == 0) return 1;
  return (fac[n] * inverse(fac[r], p) % p * inverse(fac[n - r], p) % p) % p;
}
long long seg[4000009] = {0}, lazy[4000009] = {0};
void push(long long v) {
  seg[v * 2] += lazy[v];
  seg[v * 2 + 1] += lazy[v];
  lazy[v * 2] += lazy[v];
  lazy[v * 2 + 1] += lazy[v];
  lazy[v] = 0;
}
void update(long long v, long long l, long long r, long long posl,
            long long posr, long long val) {
  if (l >= posl && r <= posr) {
    seg[v] += val;
    lazy[v] += val;
    return;
  } else if (l > posr || r < posl)
    return;
  push(v);
  long long mid = (l + r) / 2;
  update(v * 2, l, mid, posl, posr, val);
  update(v * 2 + 1, mid + 1, r, posl, posr, val);
  seg[v] = min(seg[v * 2], seg[v * 2 + 1]);
}
long long query(long long v, long long l, long long r, long long posl,
                long long posr) {
  if (l >= posl && r <= posr)
    return seg[v];
  else if (l > posr || r < posl)
    return 1e18;
  push(v);
  long long mid = (l + r) / 2;
  return min(query(v * 2, l, mid, posl, posr),
             query(v * 2 + 1, mid + 1, r, posl, posr));
}
vector<long long> v[200001];
long long back[200001] = {0};
long long normal[200001] = {0};
long long insert[200001] = {0};
long long out[200001] = {0};
long long val = 0;
void dfs(long long cur) {
  val++;
  insert[cur] = val;
  for (auto it : v[cur]) dfs(it);
  val++;
  out[cur] = val;
}
bool ances(long long u, long long v) {
  if (insert[u] <= insert[v] && out[u] >= out[v])
    return true;
  else
    return false;
}
void solve() {
  long long n, q;
  cin >> n >> q;
  map<long long, long long> m;
  for (long long i = 1; i <= n - 1; i++) {
    long long x, y, w;
    cin >> x >> y >> w;
    v[x].push_back(y);
    normal[y] = w;
    m[i] = y;
  }
  for (long long i = 1; i <= n - 1; i++) {
    long long x, y, w;
    cin >> x >> y >> w;
    back[x] = w;
    m[i + n - 1] = x;
  }
  dfs(1);
  for (long long i = 1; i <= n - 1; i++) {
    update(1, 1, 2 * n, insert[m[i]], out[m[i]], normal[m[i]]);
  }
  for (long long i = 1; i <= n - 1; i++) {
    update(1, 1, 2 * n, insert[m[i + n - 1]], insert[m[i + n - 1]],
           back[m[i + n - 1]]);
    update(1, 1, 2 * n, out[m[i + n - 1]], out[m[i + n - 1]],
           back[m[i + n - 1]]);
  }
  while (q--) {
    long long t;
    cin >> t;
    if (t == 1) {
      long long i, w;
      cin >> i >> w;
      if (i <= n - 1) {
        long long temp = normal[m[i]];
        temp = w - temp;
        normal[m[i]] = w;
        update(1, 1, 2 * n, insert[m[i]], out[m[i]], temp);
      } else {
        long long temp = back[m[i]];
        temp = w - temp;
        back[m[i]] = w;
        update(1, 1, 2 * n, insert[m[i]], insert[m[i]], temp);
        update(1, 1, 2 * n, out[m[i]], out[m[i]], temp);
      }
    } else {
      long long u, v;
      cin >> u >> v;
      if (ances(u, v)) {
        cout << query(1, 1, 2 * n, insert[v], insert[v]) -
                    query(1, 1, 2 * n, insert[u], insert[u]) + back[u] - back[v]
             << '\n';
      } else {
        cout << query(1, 1, 2 * n, insert[u], out[u]) +
                    query(1, 1, 2 * n, insert[v], insert[v]) + back[u] -
                    back[v] - query(1, 1, 2 * n, insert[u], insert[u])
             << '\n';
      }
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long test = 1;
  while (test--) {
    solve();
  }
}
