#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
#include <random>
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define all(a) (a).begin(), (a).end()
#define sz(a) (ll)((a).size())
#define heap priority_queue
#define hash_map unordered_map
#define hash_set unordered_set
#define ft first
#define sd second
#define fast ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define endl "\n"
#define y0 y0998244353
#define y1 y1998244353
#define die(cond) if (cond) for (;;) {}
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef vector<ll> vll;
typedef set<ll> sll;
typedef map<ll, ll> mll;
const ll inf = numeric_limits<ll>::max() / 100;
const ld eps = 1e-9;
const ld pi = acosl(-1);
template<typename T> inline bool mineq(T& a, T b) { return (a > b) ? (a = b, 1) : 0; }
template<typename T> inline bool maxeq(T& a, T b) { return (a < b) ? (a = b, 1) : 0; }

void solve(), read();

signed main() {
	fast;
	read();
	solve();
	return 0;
}

struct Edge {
	ll v, u, w;
	bool operator < (Edge e) {
		return v < e.v;
	}
};
struct Graph {
	ll n;
	vector<vector<Edge>> adj;
	Graph() {}
	Graph(ll n_) {
		n = n_;
		adj.resize(n);
	}
	void add(ll v, ll u, ll w) {
		adj[v].pb({ v, u, w });
		adj[u].pb({ u, v, w });
	}
};
struct Vertex {
	ll minn = inf;
	ll push = 0;
};
struct SegmentTree {
	ll n;
	vector<Vertex> t;
	SegmentTree() {}
	SegmentTree(vll& a) {
		ll LOG = log2(sz(a)) + 1;
		n = 1ll << LOG;
		t.resize(4 * n);
		build(a);
	}
	void build(vll& a) {
		for (ll i = 0; i < sz(a); i++) {
			t[n + i].minn = a[i];
		}
		for (ll i = n - 1; i >= 0; i--) {
			t[i].minn = min(t[2 * i].minn, t[2 * i + 1].minn);
		}
	}
	void push(ll v) {
		if (!t[v].push) {
			return;
		}
		t[v].minn += t[v].push;
		t[2 * v].push += t[v].push;
		t[2 * v + 1].push += t[v].push;
		t[v].push = 0;
	}
	void upd(ll v, ll tl, ll tr, ll l, ll r, ll x) {
		push(v);
		if (tl > r || tr < l) {
			return;
		}
		if (l <= tl && tr <= r) {
			t[v].push += x;
			push(v);
			return;
		}
		ll tm = (tl + tr) / 2;
		upd(2 * v, tl, tm, l, r, x);
		upd(2 * v + 1, tm + 1, tr, l, r, x);
		t[v].minn = min(t[2 * v].minn, t[2 * v + 1].minn);
	}
	ll get(ll v, ll tl, ll tr, ll l, ll r) {
		push(v);
		if (tl > r || tr < l) {
			return inf;
		}
		if (l <= tl && tr <= r) {
			return t[v].minn;
		}
		ll tm = (tl + tr) / 2;
		ll v1 = get(2 * v, tl, tm, l, r);
		ll v2 = get(2 * v + 1, tm + 1, tr, l, r);
		return min(v1, v2);
	}
};
struct Query {
	ll v, l, r, i;
};

ll n, q;
Graph g;
SegmentTree st;
vll fi, se;
vll order, ls;
vector<vector<Query>> qs;
vll ans;

void euler(ll v, ll p, ll d = 0) {
	fi[v] = inf;
	se[v] = -inf;
	for (Edge e : g.adj[v]) {
		if (e.u == p) {
			continue;
		}
		euler(e.u, e.v, d + e.w);
		mineq(fi[e.v], fi[e.u]);
		maxeq(se[e.v], se[e.u]);
	}
	if (p != v && sz(g.adj[v]) == 1) {
		order.pb(v);
		ls.pb(d);
		fi[v] = se[v] = sz(order) - 1;
	}
}
void dfs(ll v, ll p) {
	for (Query q : qs[v]) {
		ans[q.i] = st.get(1, 0, st.n - 1, q.l, q.r);
	}
	for (Edge e : g.adj[v]) {
		if (e.u == p) {
			continue;
		}
		ll w = e.w;
		st.upd(1, 0, st.n - 1, 0, n - 1, w);
		st.upd(1, 0, st.n - 1, fi[e.u], se[e.u], -2 * w);
		dfs(e.u, e.v);
		st.upd(1, 0, st.n - 1, fi[e.u], se[e.u], 2 * w);
		st.upd(1, 0, st.n - 1, 0, n - 1, -w);
	}
}

void solve() {
	fi.resize(n), se.resize(n);
	euler(0, 0, 0);
	qs.resize(n);
	for (ll i = 0; i < q; i++) {
		ll v, l, r;
		cin >> v >> l >> r;
		--v, --l, --r;
		l = lower_bound(all(order), l) - order.begin();
		r = upper_bound(all(order), r) - order.begin() - 1;
		if (l > r) {
			cout << "me" << endl;
			return;
		}
		qs[v].pb({ v, l, r, i });
	}
	st = SegmentTree(ls);
	ans.assign(q, -1);
	dfs(0, 0);
	for (ll i = 0; i < q; i++) {
		cout << ans[i] << endl;
	}
}

void read() {
	cin >> n >> q;
	g = Graph(n);
	for (ll i = 1; i < n; i++) {
		ll p, w;
		cin >> p >> w;
		--p;
		g.add(i, p, w);
	}
	for (ll i = 0; i < n; i++) {
		sort(all(g.adj[i]));
	}
}
