#include <bits/stdc++.h>
using namespace std;
long long INF;
long long qmin(long long a, long long b) { return (a < b) ? a : b; }
long long qmax(long long a, long long b) { return (a > b) ? a : b; }
int n, q;
vector<pair<int, long long> > v[500500];
int nxt[500500];
vector<pair<pair<int, int>, int> > qs[500500];
long long ans[500500];
long long dat[2001500];
long long laz[2001500];
void push_down(int now) {
  laz[now * 2] += laz[now];
  dat[now * 2] += laz[now];
  laz[now * 2 + 1] += laz[now];
  dat[now * 2 + 1] += laz[now];
  laz[now] = 0;
}
void update(int target_l, int target_r, long long val, int l, int r, int ind) {
  if (target_r < l || r < target_l) return;
  if (target_l <= l && r <= target_r) {
    laz[ind] += val;
    dat[ind] += val;
    return;
  }
  push_down(ind);
  int mid = (l + r) >> 1;
  update(target_l, target_r, val, l, mid, ind * 2);
  update(target_l, target_r, val, mid + 1, r, ind * 2 + 1);
  dat[ind] = qmin(dat[ind * 2], dat[ind * 2 + 1]);
}
long long query(int target_l, int target_r, int l, int r, int ind) {
  if (target_r < l || r < target_l) return INF;
  if (target_l <= l && r <= target_r) {
    return dat[ind];
  }
  push_down(ind);
  int mid = (l + r) >> 1;
  return qmin(query(target_l, target_r, l, mid, ind * 2),
              query(target_l, target_r, mid + 1, r, ind * 2 + 1));
}
void df1s(int now, int par, long long dist) {
  if ((int)v[now].size() == 1) {
    nxt[now] = now + 1;
    update(now, now, dist - INF, 0, n - 1, 1);
    return;
  }
  for (int i = 0; i < v[now].size(); i++) {
    if (v[now][i].first != par) {
      df1s(v[now][i].first, now, dist + v[now][i].second);
      nxt[now] = qmax(nxt[now], nxt[v[now][i].first]);
    }
  }
}
void dfs2(int now, int par) {
  for (int i = 0; i < qs[now].size(); i++) {
    ans[qs[now][i].second] =
        query(qs[now][i].first.first, qs[now][i].first.second, 0, n - 1, 1);
  }
  for (int i = 0; i < v[now].size(); i++) {
    if (v[now][i].first != par) {
      int to = v[now][i].first;
      update(to, nxt[to] - 1, -2 * v[now][i].second, 0, n - 1, 1);
      update(0, n - 1, v[now][i].second, 0, n - 1, 1);
      dfs2(to, now);
      update(to, nxt[to] - 1, 2 * v[now][i].second, 0, n - 1, 1);
      update(0, n - 1, -v[now][i].second, 0, n - 1, 1);
    }
  }
}
int main() {
  memset(laz, 0, sizeof(laz));
  memset(dat, 0x3f, sizeof(dat));
  INF = dat[0];
  scanf("%d%d", &n, &q);
  for (int i = 0; i < n - 1; i++) {
    int par;
    long long cost;
    scanf("%d%lld", &par, &cost);
    par--;
    v[par].push_back(make_pair(i + 1, cost));
    v[i + 1].push_back(make_pair(par, cost));
  }
  for (int i = 0; i < q; i++) {
    int v, l, r;
    scanf("%d%d%d", &v, &l, &r);
    l--, r--;
    v--;
    qs[v].push_back(make_pair(make_pair(l, r), i));
  }
  df1s(0, -1, 0);
  dfs2(0, -1);
  for (int i = 0; i < q; i++) cout << ans[i] << endl;
  return 0;
}
