#include <bits/stdc++.h>
using namespace std;
const int T = 1 << 19;
const long long inf = 1e17;
vector<pair<int, long long> > graf[T];
long long tree[T + T], lazy[T + T];
int kon[T];
int dfs(int a, long long d = 0) {
  int ret = a;
  for (pair<int, long long> p : graf[a])
    ret = max(ret, dfs(p.first, d + p.second));
  if ((int)graf[a].size() == 0) tree[a + T] = d;
  kon[a] = ret;
  return ret;
}
void up(int a, int lewy, int prawy) {
  if (lewy < prawy) {
    lazy[a * 2] += lazy[a];
    lazy[a * 2 + 1] += lazy[a];
  }
  tree[a] += lazy[a];
  lazy[a] = 0LL;
}
void update(int a, int lewy, int prawy) {
  if (lewy < prawy) {
    lazy[a * 2] += lazy[a];
    lazy[a * 2 + 1] += lazy[a];
    up(a * 2, lewy, (lewy + prawy) / 2);
    up(a * 2 + 1, (lewy + prawy) / 2 + 1, prawy);
    lazy[a] = 0;
    tree[a] = min(tree[a * 2], tree[a * 2 + 1]);
  } else
    up(a, lewy, prawy);
}
void add(int left, int right, long long x, int a = 1, int lewy = 0,
         int prawy = T - 1) {
  if (left > right) return;
  update(a, lewy, prawy);
  if (left <= lewy && right >= prawy)
    lazy[a] += x;
  else {
    if (left <= (lewy + prawy) / 2)
      add(left, right, x, a * 2, lewy, (lewy + prawy) / 2);
    if (right > (lewy + prawy) / 2)
      add(left, right, x, a * 2 + 1, (lewy + prawy) / 2 + 1, prawy);
  }
  update(a, lewy, prawy);
}
long long mini(int left, int right, int a = 1, int lewy = 0,
               int prawy = T - 1) {
  if (left <= lewy && right >= prawy)
    return tree[a];
  else {
    long long ret = inf;
    if (left <= (lewy + prawy) / 2)
      ret = min(ret, mini(left, right, a * 2, lewy, (lewy + prawy) / 2));
    if (right > (lewy + prawy) / 2)
      ret =
          min(ret, mini(left, right, a * 2 + 1, (lewy + prawy) / 2 + 1, prawy));
    return ret;
  }
}
vector<pair<int, pair<int, int> > > query[T];
long long ans[T];
void traw(int a, long long d = 0LL) {
  for (auto q : query[a]) {
    ans[q.first] = d + mini(q.second.first, q.second.second);
  }
  for (pair<int, long long> p : graf[a]) {
    add(p.first, kon[p.first], -(2LL * p.second));
    traw(p.first, d + p.second);
    add(p.first, kon[p.first], 2LL * p.second);
  }
}
int main() {
  int n, q;
  for (int i = 0; i < T + T; i++) tree[i] = inf;
  scanf("%d %d", &n, &q);
  int p;
  long long w;
  for (int i = 2; i < n + 1; i++) {
    scanf("%d %lld", &p, &w);
    graf[p].push_back(make_pair(i, w));
  }
  dfs(1);
  for (int a = T - 1; a > 0; a--) tree[a] = min(tree[a * 2], tree[a * 2 + 1]);
  for (int i = 0; i < q; i++) {
    int v, l, r;
    scanf("%d %d %d", &v, &l, &r);
    query[v].push_back(make_pair(i, make_pair(l, r)));
  }
  traw(1);
  for (int i = 0; i < q; i++) printf("%lld\n", ans[i]);
}
