#include <bits/stdc++.h>
inline int inp() {
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  int sum = 0;
  while (c >= '0' && c <= '9') {
    sum = sum * 10 + c - '0';
    c = getchar();
  }
  return sum;
}
struct Node {
  int l;
  int r;
  int id;
};
struct Edge {
  int end;
  long long w;
};
bool cmp(Edge a, Edge b) { return a.end < b.end; }
std::vector<Node> vec[500010];
std::vector<Edge> g[500010];
long long dis[500010];
long long dis2[500010];
long long ans[500010];
struct SEG_Tree {
  struct SEG {
    int l;
    int r;
    long long min;
    long long lazy;
  } t[4000000];
  inline void push_up(int cur) {
    t[cur].min = std::min(t[(cur << 1)].min, t[(cur << 1 | 1)].min);
  }
  inline void push_down(int cur) {
    t[(cur << 1)].min += t[cur].lazy;
    t[(cur << 1 | 1)].min += t[cur].lazy;
    t[(cur << 1)].lazy += t[cur].lazy;
    t[(cur << 1 | 1)].lazy += t[cur].lazy;
    t[cur].lazy = 0;
  }
  void build(int cur, int l, int r) {
    t[cur].l = l;
    t[cur].r = r;
    t[cur].lazy = 0;
    if (l == r) {
      t[cur].min = dis2[l];
      return;
    }
    int mid = (l + r) >> 1;
    build((cur << 1), l, mid);
    build((cur << 1 | 1), mid + 1, r);
    push_up(cur);
  }
  void modify(int cur, int l, int r, long long c) {
    if (t[cur].l > r || t[cur].r < l) return;
    push_down(cur);
    if (t[cur].l >= l & t[cur].r <= r) {
      t[cur].lazy += c;
      t[cur].min += c;
      return;
    }
    modify((cur << 1), l, r, c);
    modify((cur << 1 | 1), l, r, c);
    push_up(cur);
  }
  long long query(int cur, int l, int r) {
    if (t[cur].l > r || t[cur].r < l) return 8000000000000000000;
    push_down(cur);
    if (t[cur].l >= l && t[cur].r <= r) return t[cur].min;
    return std::min(query((cur << 1), l, r), query((cur << 1 | 1), l, r));
  }
} t;
int n;
void dfs2(int cur, int last) {
  for (int i = 0; i < g[cur].size(); i++)
    if (g[cur][i].end != last) {
      dis[g[cur][i].end] = dis[cur] + g[cur][i].w;
      dfs2(g[cur][i].end, cur);
    }
  if (g[cur].size() == 1 && last != 0)
    dis2[cur] = dis[cur];
  else
    dis2[cur] = 8000000000000000000;
}
void dfs(int cur, int last, int nr) {
  for (int i = 0; i < vec[cur].size(); i++)
    ans[vec[cur][i].id] = t.query(1, vec[cur][i].l, vec[cur][i].r);
  for (int i = 0; i < g[cur].size(); i++) {
    if (g[cur][i].end != last) {
      int l = g[cur][i].end;
      int r = ((i == (g[cur].size() - 1)) ? nr : (g[cur][i + 1].end - 1));
      t.modify(1, l, r, -(g[cur][i].w << 1));
      t.modify(1, 1, n, g[cur][i].w);
      dfs(g[cur][i].end, cur, r);
      t.modify(1, l, r, (g[cur][i].w << 1));
      t.modify(1, 1, n, -g[cur][i].w);
    }
  }
}
int main() {
  n = inp();
  int q = inp();
  for (int i = 2; i <= n; i++) {
    int p = inp();
    long long w = inp();
    g[i].push_back((Edge){p, w});
    g[p].push_back((Edge){i, w});
  }
  for (int i = 1; i <= n; i++) std::sort(g[i].begin(), g[i].end(), cmp);
  for (int i = 1; i <= q; i++) {
    Node u;
    int v = inp();
    u.l = inp();
    u.r = inp();
    u.id = i;
    vec[v].push_back(u);
  }
  dfs2(1, 0);
  t.build(1, 1, n);
  dfs(1, 0, n);
  for (int i = 1; i <= q; i++) std::cout << ans[i] << std::endl;
}
