#include <bits/stdc++.h>
using namespace std;
const int mxn = 1e5 + 5;
const long long inf = 1e16;
int n, m, cnt, in[mxn], hd[mxn], sz[mxn];
long long tr[mxn << 2], tag[mxn << 2], dep[mxn], ans[mxn];
struct Q {
  int l, r, id;
};
vector<Q> q[mxn];
inline int read() {
  char c = getchar();
  int x = 0, f = 1;
  while (c > '9' || c < '0') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c <= '9' && c >= '0') {
    x = (x << 3) + (x << 1) + (c & 15);
    c = getchar();
  }
  return x * f;
}
inline void chkmax(int &x, int y) {
  if (x < y) x = y;
}
inline void chkmin(long long &x, long long y) {
  if (x > y) x = y;
}
struct ed {
  int to, nxt;
  long long w;
} t[mxn << 1];
void push_down(int p, int l, int r) {
  if (tag[p]) {
    int mid = (l + r) >> 1;
    tag[p << 1] += tag[p];
    tag[p << 1 | 1] += tag[p];
    tr[p << 1] += tag[p];
    tr[p << 1 | 1] += tag[p];
    tag[p] = 0;
  }
}
inline void add(int u, int v, long long w) {
  t[++cnt] = (ed){v, hd[u], w};
  hd[u] = cnt;
}
void update(int l, int r, int ql, int qr, long long val, int p) {
  if (ql <= l && r <= qr) {
    tag[p] += val;
    tr[p] += val;
    return;
  }
  int mid = (l + r) >> 1;
  push_down(p, l, r);
  if (ql <= mid) update(l, mid, ql, qr, val, p << 1);
  if (qr > mid) update(mid + 1, r, ql, qr, val, p << 1 | 1);
  tr[p] = min(tr[p << 1], tr[p << 1 | 1]);
}
long long query(int l, int r, int ql, int qr, int p) {
  if (ql <= l && r <= qr) return tr[p];
  int mid = (l + r) >> 1;
  long long res = inf;
  push_down(p, l, r);
  if (ql <= mid) chkmin(res, query(l, mid, ql, qr, p << 1));
  if (qr > mid) chkmin(res, query(mid + 1, r, ql, qr, p << 1 | 1));
  return res;
}
void mod(int l, int r, int pos, long long val, int p) {
  if (l == r) {
    tr[p] = val;
    return;
  }
  int mid = (l + r) >> 1;
  if (pos <= mid)
    mod(l, mid, pos, val, p << 1);
  else
    mod(mid + 1, r, pos, val, p << 1 | 1);
  tr[p] = min(tr[p << 1], tr[p << 1 | 1]);
}
void build(int l, int r, int p) {
  if (l == r) {
    tr[p] = inf;
    return;
  }
  int mid = (l + r) >> 1;
  build(l, mid, p << 1);
  build(mid + 1, r, p << 1 | 1);
  tr[p] = min(tr[p << 1], tr[p << 1 | 1]);
}
void dfs(int u, int fa) {
  sz[u] = 1;
  if (in[u] == 1) mod(1, n, u, dep[u], 1);
  for (int i = hd[u]; i; i = t[i].nxt) {
    int v = t[i].to;
    if (v == fa) continue;
    dep[v] = dep[u] + t[i].w;
    dfs(v, u);
    sz[u] += sz[v];
  }
}
void solve(int u, int fa) {
  for (int i = 0; i < q[u].size(); ++i) {
    Q tp = q[u][i];
    ans[tp.id] = query(1, n, tp.l, tp.r, 1);
  }
  for (int i = hd[u]; i; i = t[i].nxt) {
    int v = t[i].to;
    if (v == fa) continue;
    update(1, n, 1, n, t[i].w, 1);
    update(1, n, v, v + sz[v] - 1, -2 * t[i].w, 1);
    solve(v, u);
    update(1, n, 1, n, -t[i].w, 1);
    update(1, n, v, v + sz[v] - 1, 2 * t[i].w, 1);
  }
}
int main() {
  n = read();
  m = read();
  int u, pos, l, r;
  long long w;
  build(1, n, 1);
  for (int i = 2; i <= n; ++i) {
    u = read();
    w = read();
    add(u, i, w);
    add(i, u, w);
    ++in[u], ++in[i];
  }
  for (int i = 1; i <= m; ++i)
    pos = read(), l = read(), r = read(), q[pos].push_back((Q){l, r, i});
  dfs(1, 0);
  solve(1, 0);
  for (int i = 1; i <= m; ++i) printf("%lld\n", ans[i]);
  return 0;
}
