#include <bits/stdc++.h>
template <typename T>
T gcd(T a, T b) {
  return ((a % b == 0) ? b : gcd(b, a % b));
}
template <typename T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;
namespace Problem {
using namespace std;
struct RangeMin {
  using T = long long;
  T operator()(const T &a, const T &b) { return min(a, b); }
  static constexpr T id() { return T(LINF); };
};
struct RangeAdd {
  using T = long long;
  T operator()(const T &a, const T &b) { return a + b; };
  static constexpr T id() { return T(0); };
};
struct Min_Add {
  using V = RangeMin;
  using A = RangeAdd;
  V::T operator()(const V::T &a, const A::T &b, const int &h) { return a + b; };
};
template <typename M>
struct LazySegmentTree {
  using Val = typename M::V::T;
  using Del = typename M::A::T;
  typename M::V calc;
  typename M::A composite;
  M act;
  vector<Val> val;
  vector<Del> delay;
  int n, height;
  explicit LazySegmentTree(int size) : n(1), height(0) {
    while (n < size) {
      n <<= 1;
      ++height;
    }
    val = vector<Val>(n << 1, calc.id());
    delay = vector<Del>(n << 1, composite.id());
  }
  explicit LazySegmentTree(const vector<Val> &v) : n(1), height(0) {
    while (n < v.size()) {
      n <<= 1;
      ++height;
    }
    val = vector<Val>(n << 1, calc.id());
    delay = vector<Del>(n << 1, composite.id());
    copy(v.begin(), v.end(), val.begin() + n);
    for (int i = n - 1; i > 0; --i) {
      val[i] = calc(val[i * 2], val[i * 2 + 1]);
    }
  }
  void propagate(int k, int h) {
    val[k] = act(val[k], delay[k], h);
    if (h > 0) {
      delay[2 * k] = composite(delay[2 * k], delay[k]);
      delay[2 * k + 1] = composite(delay[2 * k + 1], delay[k]);
    }
    delay[k] = composite.id();
  }
  inline void update(int l, int r, Del v) { update(l, r, v, 1, 0, n, height); }
  void update(int l, int r, Del v, int k, int a, int b, int h) {
    if (l <= a && b <= r) {
      delay[k] = composite(delay[k], v);
      propagate(k, h);
      return;
    }
    propagate(k, h);
    if (b <= l || r <= a) {
      return;
    }
    update(l, r, v, 2 * k, a, (a + b) / 2, h - 1);
    update(l, r, v, 2 * k + 1, (a + b) / 2, b, h - 1);
    val[k] = calc(val[2 * k], val[2 * k + 1]);
  }
  inline Val query(int l, int r) { return query(l, r, 1, 0, n, height); }
  Val query(int l, int r, int k, int a, int b, int h) {
    if (b <= l || r <= a) {
      return calc.id();
    }
    propagate(k, h);
    if (l <= a && b <= r) {
      return val[k];
    }
    Val vall = query(l, r, 2 * k, a, (a + b) / 2, h - 1);
    Val valr = query(l, r, 2 * k + 1, (a + b) / 2, b, h - 1);
    return calc(vall, valr);
  }
};
class Solver2 {
 public:
  int n, q;
  vector<unordered_map<int, LL>> t;
  vector<vector<pair<int, pair<int, int>>>> queries;
  vector<LL> ans, ub;
  LazySegmentTree<Min_Add> seg;
  LL geta;
  Solver2(LL n, LL q)
      : n(n), q(q), t(n), queries(n), ans(q), ub(n, -1), seg(n){};
  void solve() {
    for (int i = 0; i < n - 1; ++i) {
      int a, b;
      cin >> a >> b;
      t[i + 1][--a] = b;
      t[a][i + 1] = b;
    };
    for (int i = 0; i < q; ++i) {
      int v, l, r;
      cin >> v >> l >> r;
      queries[--v].push_back({i, {--l, --r}});
    }
    vector<LL> depth(n, -1);
    dfs(0, 0, depth);
    for (int i = 0; i < n; ++i) {
      if (t[i].size() > 1) {
        depth[i] = LINF;
      }
    };
    seg = LazySegmentTree<Min_Add>(depth);
    geta = 0;
    dfs2(0);
    for (int i = 0; i < q; ++i) {
      cout << ans[i] << endl;
    }
  }
  void dfs(int c, LL d, vector<LL> &dep) {
    ub[c] = c;
    dep[c] = d;
    for (auto v : t[c]) {
      if (dep[v.first] == -1) {
        dfs(v.first, d + v.second, dep);
        ub[c] = max(ub[c], ub[v.first]);
      }
    }
  }
  void dfs2(int c, int p = -1) {
    for (auto query : queries[c]) {
      ;
      ans[query.first] = seg.query(query.second.first, query.second.second + 1);
    }
    for (auto v : t[c]) {
      if (v.first != p) {
        go_down(c, v.first, v.second);
        dfs2(v.first, c);
      }
    }
    if (p != -1) go_up(c, p, t[c][p]);
  }
  void go_down(int a, int b, LL dist) {
    geta += dist;
    seg.update(b, ub[b] + 1, -2 * dist);
  }
  void go_up(int a, int b, LL dist) {
    geta -= dist;
    seg.update(a, ub[a] + 1, 2 * dist);
  }
};
}  // namespace Problem
int main() {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(false);
  long long n = 0, q;
  std::cin >> n >> q;
  Problem::Solver2 sol(n, q);
  sol.solve();
  return 0;
}
