#include <bits/stdc++.h>
using namespace std;
const long long maxlen = 500000;
long long n, q, u, v, le, ri, cnt = 0;
long long head[maxlen + 5], tree[8 * maxlen + 5], tag[8 * maxlen + 5],
    l[maxlen + 5], d[maxlen + 5], size[maxlen + 5], ans[maxlen + 5];
struct node {
  long long id;
  long long l, r;
};
vector<node> ve[maxlen + 5];
struct edge {
  long long next;
  long long to;
  long long dis;
} e[8 * maxlen + 5];
inline void pushup(long long rt) {
  tree[rt] = min(tree[2 * rt], tree[2 * rt + 1]);
}
inline void build_tree(long long rt, long long l, long long r) {
  if (l == r) {
    tree[rt] = d[l];
    return;
  }
  long long mid = (l + r) >> 1;
  build_tree(2 * rt, l, mid);
  build_tree(2 * rt + 1, mid + 1, r);
  pushup(rt);
}
inline void f(long long rt, long long l, long long r, long long k) {
  tree[rt] += k;
  tag[rt] += k;
}
inline void pushdown(long long rt, long long l, long long r) {
  long long mid = (l + r) >> 1;
  f(2 * rt, l, mid, tag[rt]);
  f(2 * rt + 1, mid + 1, r, tag[rt]);
  tag[rt] = 0;
}
inline void change(long long nl, long long nr, long long l, long long r,
                   long long rt, long long k) {
  if (nl <= l && r <= nr) {
    f(rt, l, r, k);
    return;
  }
  pushdown(rt, l, r);
  long long mid = (l + r) >> 1;
  if (nl <= mid) change(nl, nr, l, mid, 2 * rt, k);
  if (nr > mid) change(nl, nr, mid + 1, r, 2 * rt + 1, k);
  pushup(rt);
}
inline long long query(long long nl, long long nr, long long l, long long r,
                       long long rt) {
  pushdown(rt, l, r);
  long long minv = 200000000000007, mid = (l + r) >> 1;
  if (nl <= l && r <= nr) return tree[rt];
  if (nl <= mid) minv = min(minv, query(nl, nr, l, mid, 2 * rt));
  if (nr > mid) minv = min(minv, query(nl, nr, mid + 1, r, 2 * rt + 1));
  return minv;
}
inline void add_edge(long long u, long long v, long long w) {
  cnt++;
  e[cnt].to = v;
  e[cnt].dis = w;
  e[cnt].next = head[u];
  head[u] = cnt;
}
inline void dfs(long long now, long long fath, long long nowdis) {
  size[now] = 1;
  d[now] = nowdis;
  l[now] = 1;
  for (long long i = head[now]; i; i = e[i].next) {
    if (e[i].to != fath) {
      l[now] = 0;
      dfs(e[i].to, now, nowdis + e[i].dis);
      size[now] += size[e[i].to];
    }
  }
}
inline void change_root(long long now, long long fath, long long last) {
  change(now, now + size[now] - 1, 1, n, 1, -last);
  if (now > 1) change(1, now - 1, 1, n, 1, last);
  if (now + size[now] <= n) change(now + size[now], n, 1, n, 1, last);
  for (long long i = 0; i < ve[now].size(); i++) {
    long long id = ve[now][i].id;
    le = ve[now][i].l, ri = ve[now][i].r;
    ans[id] = query(le, ri, 1, n, 1);
  }
  for (long long i = head[now]; i; i = e[i].next) {
    if (e[i].to != fath) change_root(e[i].to, now, e[i].dis);
  }
  change(now, now + size[now] - 1, 1, n, 1, last);
  if (now > 1) change(1, now - 1, 1, n, 1, -last);
  if (now + size[now] <= n) change(now + size[now], n, 1, n, 1, -last);
}
inline long long read() {
  long long s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -w;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    s = (s << 1) + (s << 3) + (ch ^ '0');
    ch = getchar();
  }
  return s * w;
}
signed main() {
  cin >> n >> q;
  for (long long i = 2; i <= n; i++) {
    u = read(), v = read();
    add_edge(i, u, v);
    add_edge(u, i, v);
  }
  dfs(1, 0, 0);
  for (long long i = 1; i <= n; i++) {
    if (l[i] == 0) d[i] = 200000000000007;
  }
  for (long long i = 1; i <= q; i++) {
    u = read(), le = read(), ri = read();
    ve[u].push_back((node){i, le, ri});
  }
  build_tree(1, 1, n);
  change_root(1, 0, 0);
  for (long long i = 1; i <= q; i++) printf("%lld\n", ans[i]);
  return 0;
}
