#include <bits/stdc++.h>
using namespace std;
const int kn = 5e5 + 5;
const long long mod = 1e9 + 7;
struct data {
  int id, l, r;
};
long long n, q, ans[kn];
long long l[kn], a[kn], st[kn], en[kn], top = 0;
long long lazy[4 * kn], it[4 * kn];
vector<pair<long long, long long> > gr[kn];
vector<data> qr[kn];
void dfs(int u, int v, int w) {
  a[++top] = u;
  st[u] = en[u] = top;
  l[u] = l[v] + w;
  for (pair<long long, long long> cac : gr[u]) {
    if (cac.first == v) continue;
    dfs(cac.first, u, cac.second);
    en[u] = en[cac.first];
  }
}
void down(int id) {
  it[id << 1] += lazy[id];
  it[(id << 1) | 1] += lazy[id];
  lazy[id << 1] += lazy[id];
  lazy[(id << 1) | 1] += lazy[id];
  lazy[id] = 0;
}
void build(int id, int L, int R) {
  if (L == R) {
    if (gr[a[L]].size() == 1) it[id] = l[a[L]];
    return;
  }
  int mid = (L + R) / 2;
  build(id << 1, L, mid);
  build((id << 1) | 1, mid + 1, R);
  it[id] = min(it[id << 1], it[(id << 1) | 1]);
}
void upd(int id, int l, int r, int L, int R, int val) {
  if (l > R || r < L) return;
  if (l >= L && r <= R) {
    it[id] += val;
    lazy[id] += val;
    return;
  }
  if (lazy[id] != 0) down(id);
  int mid = (l + r) / 2;
  upd(id << 1, l, mid, L, R, val);
  upd((id << 1) | 1, mid + 1, r, L, R, val);
  it[id] = min(it[(id << 1)], it[(id << 1) | 1]);
}
long long get(int id, int l, int r, int L, int R) {
  if (l > R || r < L) return 1e15;
  if (l >= L && r <= R) return it[id];
  if (lazy[id] != 0) down(id);
  int mid = (l + r) / 2;
  return min(get(id << 1, l, mid, L, R), get((id << 1) | 1, mid + 1, r, L, R));
}
void DFS(int u, int v, int w) {
  upd(1, 1, n, st[u], en[u], -w);
  if (st[u] - 1 >= 1) upd(1, 1, n, 1, st[u] - 1, w);
  if (en[u] + 1 <= n) upd(1, 1, n, en[u] + 1, n, w);
  for (data cac : qr[u]) {
    ans[cac.id] = get(1, 1, n, cac.l, cac.r);
  }
  for (pair<long long, long long> cac : gr[u]) {
    if (cac.first != v) DFS(cac.first, u, cac.second);
  }
  upd(1, 1, n, st[u], en[u], w);
  if (st[u] - 1 >= 1) upd(1, 1, n, 1, st[u] - 1, -w);
  if (en[u] + 1 <= n) upd(1, 1, n, en[u] + 1, n, -w);
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= 4 * n; i++) it[i] = 1e15;
  for (int i = 2; i <= n; i++) {
    long long u, w;
    scanf("%lld%lld", &u, &w);
    gr[u].push_back(pair<long long, long long>(i, w));
    gr[i].push_back(pair<long long, long long>(u, w));
  }
  for (int i = 1; i <= q; i++) {
    int u, l, r;
    scanf("%d%d%d", &u, &l, &r);
    qr[u].push_back({i, l, r});
  }
  dfs(1, 1, 0);
  build(1, 1, n);
  DFS(1, 1, 0);
  for (int i = 1; i <= q; i++) printf("%lld\n", ans[i]);
}
