#include <bits/stdc++.h>
#pragma GCC target("avx,sse2,sse3,sse4,popcnt")
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
using namespace std;
inline void rd(long long &X) {
  X = 0;
  long long w = 0;
  char ch = 0;
  while (!isdigit(ch)) w |= ch == '-', ch = getchar();
  while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
  X = w ? -X : X;
}
vector<long long> v[500005];
long long n, m, ADD;
long long head[500005], cnt;
long long mn[500005 << 2], tag[500005 << 2], ok[500005];
long long ans[500005], l[500005], r[500005], dis[500005], sz[500005];
struct nd {
  long long nxt, to, v;
} e[500005 << 1];
inline void add(long long x, long long y, long long v) {
  e[++cnt] = (nd){head[x], y, v};
  head[x] = cnt;
}
void push(long long p) {
  if (!tag[p]) return;
  long long x = tag[p];
  tag[p] = 0;
  mn[(p << 1)] += x;
  mn[(p << 1 | 1)] += x;
  tag[(p << 1)] += x;
  tag[(p << 1 | 1)] += x;
}
void change(long long p, long long L, long long R, long long d, long long l = 1,
            long long r = n) {
  if (L <= l and r <= R) return mn[p] += d, tag[p] += d, void();
  push(p);
  if (L <= ((l + r) >> 1)) change((p << 1), L, R, d, l, ((l + r) >> 1));
  if (R > ((l + r) >> 1)) change((p << 1 | 1), L, R, d, ((l + r) >> 1) + 1, r);
  mn[p] = min(mn[(p << 1)], mn[(p << 1 | 1)]);
}
long long ask(long long p, long long L, long long R, long long l = 1,
              long long r = n) {
  if (L <= l and r <= R) return mn[p];
  push(p);
  long long v = 1e18;
  if (L <= ((l + r) >> 1)) v = ask((p << 1), L, R, l, ((l + r) >> 1));
  if (R > ((l + r) >> 1))
    v = min(v, ask((p << 1 | 1), L, R, ((l + r) >> 1) + 1, r));
  return v;
}
void build(long long p, long long l, long long r) {
  if (l == r) return mn[p] = ok[l] ? 1e15 : dis[l], void();
  build((p << 1), l, ((l + r) >> 1));
  build((p << 1 | 1), ((l + r) >> 1) + 1, r);
  mn[p] = min(mn[(p << 1)], mn[(p << 1 | 1)]);
}
void dfs1(long long x) {
  sz[x] = 1;
  for (long long y, i = head[x]; (y = e[i].to); i = e[i].nxt)
    dfs1(y), sz[x] += sz[y];
}
void dfs(long long x) {
  for (long long y : v[x]) ans[y] = ask(1, l[y], r[y]) + ADD;
  for (long long y, i = head[x]; (y = e[i].to); i = e[i].nxt) {
    long long c = e[i].v;
    change(1, y, y + sz[y] - 1, -2 * c);
    ADD += c;
    dfs(y);
    change(1, y, y + sz[y] - 1, 2 * c);
    ADD -= c;
  }
}
signed main() {
  rd(n);
  rd(m);
  for (long long x, y, i = 2; i <= n; i++)
    rd(x), rd(y), add(x, i, y), dis[i] = dis[x] + y, ok[x] = 1;
  for (long long x, i = 1; i <= m; i++)
    rd(x), rd(l[i]), rd(r[i]), v[x].push_back(i);
  build(1, 1, n);
  dfs1(1);
  dfs(1);
  for (long long i = 1; i <= m; i++) printf("%lld\n", ans[i]);
}
