#include <bits/stdc++.h>
using namespace std;
const int INF = 1000 * 1000 * 1000 + 7;
const long long LINF = 1ll * INF * INF;
const int MAX = 1e5 + 7;
const double PI = acos(-1.);
const double EPS = 1e-8;
const int MOD = 1000 * 1000 * 1000 + 7;
const int N = 5 * MAX;
vector<pair<int, int>> x[N];
vector<pair<pair<int, int>, int>> que[N];
long long t[4 * N], dist[N];
long long is[4 * N], tin[N], tout[N], timer = 0, ans[N];
int n, q;
void dfs(int v, int par = -1) {
  tin[v] = ++timer;
  for (auto e : x[v]) {
    int to = e.first;
    int w = e.second;
    if (to != par) {
      dist[to] = dist[v] + w;
      dfs(to, v);
    }
  }
  tout[v] = timer;
}
void build(int v, int vl, int vr) {
  if (vl == vr) {
    if (tin[vl] == tout[vl]) {
      t[v] = dist[vl];
    } else {
      t[v] = LINF;
    }
    return;
  }
  int mid = (vl + vr) >> 1;
  build(v + v, vl, mid);
  build(v + v + 1, mid + 1, vr);
  t[v] = min(t[v + v], t[v + v + 1]);
}
void push(int v, int vl, int vr) {
  if (is[v] != 0) {
    t[v] += is[v];
    if (vl != vr) {
      is[v + v] += is[v];
      is[v + v + 1] += is[v];
    }
    is[v] = 0;
  }
}
void update(int v, int vl, int vr, int l, int r, int val) {
  push(v, vl, vr);
  if (vl > r || l > vr || l > r || vl > vr) {
    return;
  }
  if (vl >= l && vr <= r) {
    is[v] = val;
    push(v, vl, vr);
    return;
  }
  int mid = (vl + vr) >> 1;
  update(v + v, vl, mid, l, r, val);
  update(v + v + 1, mid + 1, vr, l, r, val);
  t[v] = min(t[v + v], t[v + v + 1]);
}
long long getAns(int v, int vl, int vr, int l, int r) {
  push(v, vl, vr);
  if (vl > r || l > vr || l > r || vl > vr) {
    return LINF;
  }
  if (vl >= l && vr <= r) {
    return t[v];
  }
  int mid = (vl + vr) >> 1;
  return min(getAns(v + v, vl, mid, l, r),
             getAns(v + v + 1, mid + 1, vr, l, r));
}
void calc(int v, int par = -1) {
  for (auto query : que[v]) {
    int l = query.first.first;
    int r = query.first.second;
    ans[query.second] = getAns(1, 1, n, l, r);
  }
  for (auto e : x[v]) {
    int to = e.first;
    int w = e.second;
    if (to != par) {
      update(1, 1, n, 1, tin[to] - 1, w);
      update(1, 1, n, tout[to] + 1, n, w);
      update(1, 1, n, tin[to], tout[to], -w);
      calc(to, v);
      update(1, 1, n, 1, tin[to] - 1, -w);
      update(1, 1, n, tout[to] + 1, n, -w);
      update(1, 1, n, tin[to], tout[to], w);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> q;
  for (int i = 2; i < n + 1; ++i) {
    int p, w;
    cin >> p >> w;
    x[i].push_back({p, w});
    x[p].push_back({i, w});
  }
  for (int i = 1; i < n + 1; ++i) {
    sort(x[i].begin(), x[i].end());
  }
  dfs(1);
  build(1, 1, n);
  for (int i = 0; i < q; ++i) {
    int v, l, r;
    cin >> v >> l >> r;
    que[v].push_back({{l, r}, i});
  }
  calc(1);
  for (int i = 0; i < q; ++i) {
    cout << ans[i] << endl;
  }
  return 0;
}
