#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cout << *it << " = " << a << endl;
  err(++it, args...);
}
const int MAX = 5e5 + 10;
const long long INF = 1e18;
struct SegmentTree {
  int n;
  vector<long long> a;
  vector<long long> tree;
  vector<long long> lazy;
  SegmentTree(int n) : n(n), a(n), tree(4 * n), lazy(4 * n) {}
  void build(int i, int st, int en) {
    if (st == en) {
      tree[i] = a[st];
      return;
    }
    int mid = (st + en) / 2;
    build(2 * i, st, mid);
    build(2 * i + 1, mid + 1, en);
    tree[i] = min(tree[2 * i], tree[2 * i + 1]);
  }
  void update(int i, int st, int en, int l, int r, long long val) {
    if (lazy[i]) {
      tree[i] += lazy[i];
      if (st != en) {
        lazy[2 * i] += lazy[i];
        lazy[2 * i + 1] += lazy[i];
      }
      lazy[i] = 0;
    }
    if (en < l || st > r) {
      return;
    }
    if (l <= st && en <= r) {
      tree[i] += val;
      if (st != en) {
        lazy[2 * i] += val;
        lazy[2 * i + 1] += val;
      }
      return;
    }
    int mid = (st + en) / 2;
    update(2 * i, st, mid, l, r, val);
    update(2 * i + 1, mid + 1, en, l, r, val);
    tree[i] = min(tree[2 * i], tree[2 * i + 1]);
  }
  long long query(int i, int st, int en, int l, int r) {
    if (lazy[i]) {
      tree[i] += lazy[i];
      if (st != en) {
        lazy[2 * i] += lazy[i];
        lazy[2 * i + 1] += lazy[i];
      }
      lazy[i] = 0;
    }
    if (en < l || st > r) {
      return 1e18;
    }
    if (l <= st && en <= r) {
      return tree[i];
    }
    int mid = (st + en) / 2;
    return min(query(2 * i, st, mid, l, r),
               query(2 * i + 1, mid + 1, en, l, r));
  }
};
int tin[MAX], tout[MAX], tim, n;
pair<int, int> Q[MAX];
long long d[MAX], ans[MAX];
bool leaf[MAX];
vector<int> query[MAX];
vector<pair<int, int>> g[MAX];
SegmentTree seg(MAX);
void dfs(int u) {
  int cnt = 0;
  tin[u] = ++tim;
  for (auto e : g[u]) {
    int v = e.first, w = e.second;
    d[v] = d[u] + w;
    dfs(v);
    cnt++;
  }
  tout[u] = tim;
  leaf[u] = cnt == 0;
}
void solve(int u) {
  for (int q : query[u]) {
    int l = Q[q].first, r = Q[q].second;
    ans[q] = seg.query(1, 1, n, l, r);
  }
  for (auto e : g[u]) {
    int v = e.first, w = e.second;
    seg.update(1, 1, n, 1, n, w);
    seg.update(1, 1, n, tin[v], tout[v], -2 * w);
    solve(v);
    seg.update(1, 1, n, 1, n, -w);
    seg.update(1, 1, n, tin[v], tout[v], 2 * w);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int q;
  cin >> n >> q;
  for (int i = 2; i <= n; i++) {
    int p, w;
    cin >> p >> w;
    g[p].push_back({i, w});
  }
  dfs(1);
  for (int i = 1; i <= n; i++) {
    seg.a[i] = (leaf[i] ? d[i] : INF);
  }
  seg.build(1, 1, n);
  for (int i = 0; i < q; i++) {
    int v;
    cin >> v >> Q[i].first >> Q[i].second;
    query[v].push_back(i);
  }
  solve(1);
  for (int i = 0; i < q; i++) {
    cout << ans[i] << "\n";
  }
  return 0;
}
