n, q = map(int, input().split())
children = [[]] * (n+1)
upiti = [[]] * (n+1)
hi = [0] * (n+1)
dub = [0] * (n+1)
ans = [10**18] * q

class Segmentno:
	def __init__(self):
		self.a = [0] * (2 * 524288)
		self.b = [0] * (2 * 524288)

	def push(self, x):
		if x < 524288:
			self.b[2*x] += self.b[x]
			self.b[2*x + 1] += self.b[x]
		self.a[x] += self.b[x]
		self.b[x] = 0

	def update_impl(self, l, r, v, x, xl, xr):
		if r < xl or xr < l:
			self.push(x)
			return
		if l <= xl and xr <= r:
			self.b[x] += v
			self.push(x)
			return
		xm = (xl + xr) // 2
		self.push(x)
		self.update_impl(l, r, v, 2*x, xl, xm)
		self.update_impl(l, r, v, 2*x+1, xm+1, xr)
		self.a[x] = min(self.a[2*x:2*x+2])

	def update(self, l, r, v):
		self.update_impl(l, r, v, 1, 1, 524288)

	def get_impl(self, l, r, x, xl, xr):
		self.push(x)
		if r < xl or xr < l:
			return 10 ** 18
		if l <= xl and xr <= r:
			return self.a[x]
		xm = (xl + xr) // 2
		return min([
			self.get_impl(l, r, 2*x, xl, xm),
			self.get_impl(l, r, 2*x+1, xm+1, xr)
		])

	def get(self, l, r):
		return self.get_impl(l, r, 1, 1, 524288)

for i in range(2, n+1):
	p, w = map(int, input().split())
	if children[p] == []:
		children[p] = []
	children[p] += [(i, w)]

drvo = Segmentno()

def calc_hi(x):
	hi[x] = x
	for y, w in children[x]:
		dub[y] = dub[x] + w
		calc_hi(y)
		hi[x] = hi[y]

calc_hi(1)

for i in range(1, n+1):
	print(children[i])
	if len(children[i]) > 0:
		drvo.update(i, i, 10**18)
	else:
		drvo.update(i, i, dub[i])

for i in range(q):
	x, l, r = map(int, input().split())
	if upiti[x] == []:
		upiti[x] = []
	upiti[x] += [(l, r, i)]

def dfs(x):
	for l, r, i in upiti[x]:
		ans[i] = drvo.get(l, r)
	for y, w in children[x]:
		drvo.update(1, n, w)
		drvo.update(y, hi[y], -w-w)
		dfs(y)
		drvo.update(y, hi[y], w+w)
		drvo.update(1, n, -w)

dfs(1)

for x in ans:
	print(x)


