#include <bits/stdc++.h>
using namespace std;
void read(int &x) {
  char ch;
  bool ok;
  for (ok = 0, ch = getchar(); !isdigit(ch); ch = getchar())
    if (ch == '-') ok = 1;
  for (x = 0; isdigit(ch); x = x * 10 + ch - '0', ch = getchar())
    ;
  if (ok) x = -x;
}
const int maxn = 5e5 + 10;
const long long inf = 1e15;
int n, m, cnt, mx[maxn], v[maxn * 2], pre[maxn * 2], nxt[maxn * 2], h[maxn],
    x[maxn], y[maxn], now = 1;
struct oo {
  int l, r;
  long long mx, la;
} s[maxn * 4];
struct o {
  int v, l, r, id;
} a[maxn];
long long ans[maxn], g;
void add(int x, int y, int z) {
  pre[++cnt] = y, nxt[cnt] = h[x], h[x] = cnt, v[cnt] = z;
  pre[++cnt] = x, nxt[cnt] = h[y], h[y] = cnt, v[cnt] = z;
}
void update(int x) { s[x].mx = min(s[x << 1].mx, s[x << 1 | 1].mx); }
void build(int x, int l, int r) {
  s[x].l = l, s[x].r = r;
  if (l == r) {
    s[x].mx = inf;
    return;
  }
  int mid = (l + r) >> 1;
  build(x << 1, l, mid), build(x << 1 | 1, mid + 1, r);
  update(x);
}
void pushdown(int x) {
  int ls = x << 1, rs = x << 1 | 1;
  s[ls].mx += s[x].la, s[rs].mx += s[x].la;
  s[ls].la += s[x].la, s[rs].la += s[x].la;
  s[x].la = 0;
}
void change(int x, int l, int r, long long v, int id) {
  if (l <= s[x].l && r >= s[x].r) {
    id ? s[x].mx = v : s[x].mx += v;
    s[x].la += v;
    return;
  }
  if (s[x].la) pushdown(x);
  int mid = (s[x].l + s[x].r) >> 1;
  if (l <= mid) change(x << 1, l, r, v, id);
  if (r > mid) change(x << 1 | 1, l, r, v, id);
  update(x);
}
void dfs(int x, int fa, long long dep) {
  mx[x] = x;
  for (register int i = h[x]; i; i = nxt[i])
    if (pre[i] != fa)
      dfs(pre[i], x, dep + v[i]), mx[x] = max(mx[x], mx[pre[i]]);
  if (mx[x] == x) change(1, x, x, dep, 1);
}
bool cmp(o a, o b) { return a.v < b.v; }
void get(int x, int l, int r) {
  if (l <= s[x].l && r >= s[x].r) {
    g = min(g, s[x].mx);
    return;
  }
  if (s[x].la) pushdown(x);
  int mid = (s[x].l + s[x].r) >> 1;
  if (l <= mid) get(x << 1, l, r);
  if (r > mid) get(x << 1 | 1, l, r);
  update(x);
}
void dfs1(int x, int fa) {
  while (a[now].v == x)
    g = inf, get(1, a[now].l, a[now].r), ans[a[now].id] = g, now++;
  for (register int i = h[x]; i; i = nxt[i])
    if (pre[i] != fa) {
      change(1, 1, n, v[i], 0), change(1, pre[i], mx[pre[i]], -2 * v[i], 0);
      dfs1(pre[i], x);
      change(1, 1, n, -v[i], 0), change(1, pre[i], mx[pre[i]], 2 * v[i], 0);
    }
}
signed main() {
  read(n), read(m), build(1, 1, n);
  for (register int i = 2; i <= n; i++) read(x[i]), read(y[i]);
  for (register int i = n; i >= 2; i--) add(i, x[i], y[i]);
  dfs(1, 0, 0);
  for (register int i = 1; i <= m; i++)
    read(a[i].v), read(a[i].l), read(a[i].r), a[i].id = i;
  sort(a + 1, a + m + 1, cmp);
  dfs1(1, 0);
  for (register int i = 1; i <= m; i++) printf("%lld\n", ans[i]);
}
