#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1, c = getchar();
  while (c < 48) c == '-' && (f = -1), c = getchar();
  while (c > 47) x = x * 10 + c - '0', c = getchar();
  return x * f;
}
const long long INF = 1ll << 62;
const int MAXN = 500005;
struct Edge {
  int to, val;
};
std::vector<Edge> G[MAXN];
vector<int> adj[MAXN];
int fa[MAXN], dep[MAXN], size[MAXN];
int past[MAXN], lp[MAXN], rp[MAXN];
long long dis[MAXN], a[MAXN], ans[MAXN];
long long mn[MAXN << 2], tag[MAXN << 2];
int n, q;
inline void addedge(int u, int v, int w) { G[u].push_back(Edge{v, w}); }
inline void insert(int u, int v) { adj[u].push_back(v); }
inline void pushup(int x) { mn[x] = min(mn[x << 1], mn[x << 1 | 1]); }
inline void pushdown(int x, int l, int r) {
  if (!tag[x]) return;
  tag[x << 1] += tag[x], tag[x << 1 | 1] += tag[x];
  mn[x << 1] += tag[x], mn[x << 1 | 1] += tag[x];
  tag[x] = 0;
}
void build(int l, int r, int x) {
  if (l == r) {
    mn[x] = a[l];
    return;
  }
  int mid = l + r >> 1;
  build(l, mid, x << 1);
  build(mid + 1, r, x << 1 | 1);
  pushup(x);
}
void modify(int nl, int nr, int l, int r, int x, long long k) {
  if (nl <= l && r <= nr) {
    mn[x] += k, tag[x] += k;
    return;
  }
  int mid = l + r >> 1;
  pushdown(x, l, r);
  if (nl <= mid) modify(nl, nr, l, mid, x << 1, k);
  if (nr > mid) modify(nl, nr, mid + 1, r, x << 1 | 1, k);
  pushup(x);
}
long long query(int nl, int nr, int l, int r, int x) {
  if (nl <= l && r <= nr) return mn[x];
  long long res = INF, mid = l + r >> 1;
  pushdown(x, l, r);
  if (nl <= mid) res = min(res, query(nl, nr, l, mid, x << 1));
  if (nr > mid) res = min(res, query(nl, nr, mid + 1, r, x << 1 | 1));
  return res;
}
void dfs1(int x, int f) {
  size[x] = 1;
  fa[x] = f;
  dep[x] = dep[f] + 1;
  past[x] = x;
  for (Edge &e : G[x]) {
    dis[e.to] = dis[x] + e.val;
    dfs1(e.to, x);
    size[x] += size[e.to];
    past[x] = max(past[x], past[e.to]);
  }
}
void dfs2(int x) {
  for (int &y : adj[x]) ans[y] = query(lp[y], rp[y], 1, n, 1);
  for (Edge &e : G[x]) {
    modify(1, n, 1, n, 1, e.val);
    modify(e.to, past[e.to], 1, n, 1, -(e.val << 1));
    dfs2(e.to);
    modify(1, n, 1, n, 1, -e.val);
    modify(e.to, past[e.to], 1, n, 1, e.val << 1);
  }
}
int main(int argc, char const *argv[]) {
  n = read();
  q = read();
  memset(mn, 0x3f, sizeof(mn));
  int x, y, w;
  for (int i = 2; i <= n; ++i) {
    y = read();
    w = read();
    addedge(y, i, w);
  }
  dfs1(1, 0);
  for (int i = 1; i <= n; ++i) a[i] = i == past[i] ? dis[i] : INF;
  build(1, n, 1);
  for (int i = 1; i <= q; ++i) {
    y = read();
    lp[i] = read();
    rp[i] = read();
    insert(y, i);
  }
  dfs2(1);
  for (int i = 1; i <= q; ++i) printf("%lld\n", ans[i]);
  return 0;
}
