#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, neg = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') neg = -1;
    c = getchar();
  }
  while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
  return x * neg;
}
inline void print(long long x) {
  if (x < 0) {
    putchar('-');
    print(abs(x));
    return;
  }
  if (x <= 9)
    putchar(x + '0');
  else {
    print(x / 10);
    putchar(x % 10 + '0');
  }
}
inline long long qpow(long long x, long long e, long long _MOD) {
  long long ans = 1;
  while (e) {
    if (e & 1) ans = ans * x % _MOD;
    x = x * x % _MOD;
    e >>= 1;
  }
  return ans;
}
long long n = read(), m = read();
vector<pair<long long, long long> > g[500005];
long long L[500005], R[500005], dist[500005], idx = 0;
inline void dfs1(long long x, long long fa) {
  L[x] = ++idx;
  for (__typeof(g[x].begin()) it = g[x].begin(); it != g[x].end(); it++) {
    long long y = it->first, z = it->second;
    if (y == fa) continue;
    dist[y] = dist[x] + z;
    dfs1(y, x);
  }
  R[x] = idx;
}
struct Q {
  long long v, l, r;
} q[500005];
vector<long long> qvec[500005];
long long ans[500005], offset = 0, isLeaf[500005];
struct SegTree {
  struct node {
    long long l, r, val, lz;
  } s[500005 << 2];
  inline void pushdown(long long k) {
    if (!s[k].lz) return;
    s[k << 1].lz += s[k].lz;
    s[k << 1].val += s[k].lz;
    s[k << 1 | 1].lz += s[k].lz;
    s[k << 1 | 1].val += s[k].lz;
    s[k].lz = 0;
  }
  inline void build(long long k, long long l, long long r) {
    s[k].l = l;
    s[k].r = r;
    s[k].lz = 0;
    if (l == r) {
      if (isLeaf[l])
        s[k].val = dist[l];
      else
        s[k].val = 1ll << 55;
      return;
    }
    long long mid = (l + r) >> 1;
    build(k << 1, l, mid);
    build(k << 1 | 1, mid + 1, r);
    s[k].val = min(s[k << 1].val, s[k << 1 | 1].val);
  }
  inline void modify(long long k, long long l, long long r, long long val) {
    if (l <= s[k].l && s[k].r <= r) {
      s[k].lz += val;
      s[k].val += val;
      return;
    }
    pushdown(k);
    long long mid = (s[k].l + s[k].r) >> 1;
    if (r <= mid)
      modify(k << 1, l, r, val);
    else if (l > mid)
      modify(k << 1 | 1, l, r, val);
    else
      modify(k << 1, l, mid, val), modify(k << 1 | 1, mid + 1, r, val);
    s[k].val = min(s[k << 1].val, s[k << 1 | 1].val);
  }
  inline long long query(long long k, long long l, long long r) {
    if (l <= s[k].l && s[k].r <= r) {
      return s[k].val;
    }
    pushdown(k);
    long long mid = (s[k].l + s[k].r) >> 1;
    if (r <= mid)
      return query(k << 1, l, r);
    else if (l > mid)
      return query(k << 1 | 1, l, r);
    else
      return min(query(k << 1, l, mid), query(k << 1 | 1, mid + 1, r));
  }
} st;
inline void dfs2(long long x, long long fa, long long w) {
  st.modify(1, L[x], R[x], -2 * w);
  offset += w;
  for (__typeof(qvec[x].begin()) it = qvec[x].begin(); it != qvec[x].end();
       it++) {
    long long ind = *it;
    ans[ind] = st.query(1, q[ind].l, q[ind].r) + offset;
  }
  for (__typeof(g[x].begin()) it = g[x].begin(); it != g[x].end(); it++) {
    long long y = it->first, z = it->second;
    if (y == fa) continue;
    dfs2(y, x, z);
  }
  st.modify(1, L[x], R[x], 2 * w);
  offset -= w;
}
signed main() {
  for (long long i = 2; i <= n; i++) {
    long long u = read(), v = i, w = read();
    g[u].push_back({v, w});
    g[v].push_back({u, w});
  }
  for (long long i = 1; i <= n; i++) sort(g[i].begin(), g[i].end());
  for (long long i = 1; i <= n; i++) isLeaf[i] = (g[i].size() == 1);
  dfs1(1, 0);
  st.build(1, 1, n);
  for (long long i = 1; i <= m; i++) {
    q[i].v = read();
    q[i].l = read();
    q[i].r = read();
    qvec[q[i].v].push_back(i);
  }
  dfs2(1, 0, 0);
  for (long long i = 1; i <= m; i++) print(ans[i]), putchar('\n');
  return 0;
}
