#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 5;
const int Q = 5e5 + 5;
int n, q;
vector<pair<int, int> > al[N];
long long d[N];
int rt[N];
pair<int, int> query[Q];
long long ans[Q];
vector<int> at[N];
struct node {
  int s, e, m;
  long long v, lz;
  node *l, *r;
  node(int _s, int _e) : s(_s), e(_e), m((_s + _e) / 2), v(0), lz(0) {
    if (s != e) {
      l = new node(s, m);
      r = new node(m + 1, e);
    }
  }
  long long val() {
    if (lz != 0) {
      v += lz;
      if (s != e) {
        l->lz += lz;
        r->lz += lz;
      }
      lz = 0;
    }
    return v;
  }
  void update(int x, int y, long long v) {
    if (s == x && e == y) {
      lz += v;
      return;
    } else if (y <= m)
      l->update(x, y, v);
    else if (x > m)
      r->update(x, y, v);
    else
      l->update(x, m, v), r->update(m + 1, y, v);
    this->v = min(l->val(), r->val());
  }
  long long query(int x, int y) {
    val();
    if (s == x && e == y)
      return val();
    else if (y <= m)
      return l->query(x, y);
    else if (x > m)
      return r->query(x, y);
    else
      return min(l->query(x, m), r->query(m + 1, y));
  }
  void dbg() {
    cout << "NODE " << s << " " << e << " : " << v << " " << lz << endl;
    if (s != e) {
      l->dbg();
      r->dbg();
    }
  }
} * root;
int dfs(int u, int p) {
  rt[u] = u;
  for (auto v : al[u])
    if (v.first != p) {
      d[v.first] = d[u] + v.second;
      rt[u] = max(rt[u], dfs(v.first, u));
    }
  return rt[u];
}
void solve(int u, int p) {
  for (int qi : at[u]) {
    ans[qi] = root->query(query[qi].first, query[qi].second);
  }
  for (auto v : al[u])
    if (v.first != p) {
      root->update(1, n, v.second);
      root->update(v.first, rt[v.first], -2 * v.second);
      solve(v.first, u);
      root->update(1, n, -v.second);
      root->update(v.first, rt[v.first], 2 * v.second);
    }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> q;
  for (int i = 2; i <= n; ++i) {
    int p, w;
    cin >> p >> w;
    al[p].push_back(pair<int, int>(i, w));
    al[i].push_back(pair<int, int>(p, w));
  }
  for (int i = 1; i <= q; ++i) {
    int v, l, r;
    cin >> v >> l >> r;
    query[i] = pair<int, int>(l, r);
    at[v].push_back(i);
  }
  d[1] = 0;
  dfs(1, 0);
  root = new node(1, n);
  for (int i = 1; i <= n; ++i) {
    if (al[i].size() == 1)
      root->update(i, i, d[i]);
    else
      root->update(i, i, (long long)1e18);
  }
  solve(1, 0);
  for (int i = 1; i <= q; ++i) {
    cout << ans[i] << '\n';
  }
}
