#include <bits/stdc++.h>
using namespace std;
struct node {
  int pos, l, r;
};
vector<node> query[500001];
vector<pair<int, long long> > edge[500001];
long long owe[2100000], a[2100000], result[500001], next_id = 1;
int lab[500001], l[500001], r[500001], cd, q, u, w;
void prop(int lab, int x) {
  owe[lab] += x;
  a[lab] += x;
}
void update(int l, int r, int l1, int r1, int x, int lab) {
  if (l > r || r < l1 || l > r1) return;
  if (l != r) prop(lab * 2, owe[lab]);
  prop(lab * 2 + 1, owe[lab]);
  owe[lab] = 0;
  if (l >= l1 && r <= r1) {
    a[lab] += x;
    owe[lab] += x;
    return;
  }
  update(l, (l + r) / 2, l1, r1, x, lab * 2);
  update((l + r) / 2 + 1, r, l1, r1, x, lab * 2 + 1);
  a[lab] = max(a[lab * 2], a[lab * 2 + 1]);
}
long long get(int l, int r, int l1, int r1, int lab) {
  if (r < l || r1 < l1) return -10000000000000000;
  if (l != r) prop(lab * 2, owe[lab]);
  prop(lab * 2 + 1, owe[lab]);
  owe[lab] = 0;
  if (l == l1 && r == r1) return a[lab];
  return max(
      get(l, (l + r) / 2, l1, min(r1, (l + r) / 2), lab * 2),
      get((l + r) / 2 + 1, r, max(l1, (l + r) / 2 + 1), r1, lab * 2 + 1));
}
void inp() {
  cin >> cd >> q;
  for (int i = 1; i < cd; i++) {
    cin >> u >> w;
    edge[u].push_back(pair<int, long long>(i + 1, -w));
    edge[i + 1].push_back(pair<int, long long>(u, -w));
  }
  for (int i = 1; i <= q; i++) {
    node sp;
    sp.pos = i;
    cin >> u >> sp.l >> sp.r;
    query[u].push_back(sp);
  }
}
void dfs_for_lab(int u, int dad) {
  lab[u] = next_id;
  next_id++;
  for (auto v : edge[u])
    if (v.first != dad) dfs_for_lab(v.first, u);
}
void dfs_for_lr(int u, int dad, long long x) {
  l[u] = 1e9, r[u] = -1e9;
  if (u != 1 && edge[u].size() == 1) {
    l[u] = r[u] = lab[u];
    update(1, cd, lab[u], lab[u], x, 1);
    return;
  }
  for (auto v : edge[u])
    if (v.first != dad)
      dfs_for_lr(v.first, u, x + v.second), l[u] = min(l[u], l[v.first]),
                                            r[u] = max(r[u], r[v.first]);
}
void dfs_for_result(int u, int dad) {
  for (auto k : query[u]) result[k.pos] = -1 * get(1, cd, k.l, k.r, 1);
  for (auto v : edge[u])
    if (v.first != dad) {
      update(1, cd, 1, cd, v.second, 1);
      update(1, cd, l[v.first], r[v.first], -2 * v.second, 1);
      dfs_for_result(v.first, u);
      update(1, cd, 1, cd, -v.second, 1);
      update(1, cd, l[v.first], r[v.first], 2 * v.second, 1);
    }
}
void do_it() {
  lab[1] = 1;
  dfs_for_lab(1, 0);
  dfs_for_lr(1, 0, 0);
  for (int i = 1; i <= cd; i++) {
    if (i == 1 || edge[i].size() != 1) update(1, cd, lab[i], lab[i], -1e18, 1);
  }
  dfs_for_result(1, 1);
  for (int i = 1; i <= q; i++) cout << result[i] << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  inp();
  do_it();
}
