#include<cstdio>
#include<cstring>
#include<cctype>
#include<utility>
#include<algorithm>
#include<cmath>
using namespace std;
#define res register int
#define ll long long
//#define cccgift
#define getchar()(p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
char buf[1<<21],*p1=buf,*p2=buf;
namespace wode{
    template<typename T>
    inline void read(T &x)
    {
        static char ch;bool f=1;
        for(x=0,ch=getchar();!isdigit(ch);ch=getchar()) if(ch=='-') f=0;
        for(;isdigit(ch);x=(x<<1)+(x<<3)+(ch^48),ch=getchar());x=f?x:-x;
    }
    template<typename T>
    void print(T x)
    {
        if (x<0) putchar('-'),x=-x;
        if (x>=10) print(x/10);
        putchar(x%10+'0');
    }
    template<typename T>
    inline void print(T x,char ap) {print(x);if (ap) putchar(ap);}
    template<typename T>
    inline T max(const T &x,const T &y) {return x<y?y:x;}
    template<typename T>
    inline T min(const T &x,const T &y) {return x<y?x:y;}
    template<typename T>
    inline void chkmax(T &x,const T &y) {x=x<y?y:x;}
    template<typename T>
    inline void chkmin(T &x,const T &y) {x=x<y?x:y;}
}
using wode::read;using wode::chkmin;using wode::chkmax;using wode::print;
int n,m,x,y,len[500001],L[500001],R[500001],ver[500001],nxt[500001],head[500001],edge[500001],ans,ans1,ver1[500001],nxt1[500001],head1[500001];
ll dat[2000001],tot[500001],ad[2000001],d[500001];
inline void spread(int q) {
	if(ad[q]) {
		ad[q<<1]+=ad[q],ad[q<<1|1]+=ad[q];
		dat[q<<1]+=ad[q],dat[q<<1|1]+=ad[q];
		ad[q]=0;
	}
}
void change(int q,int l1,int r1,int l,int r,int k) {
	if(r<l1||r1<l) return;
	if(l<=l1&&r1<=r) return (void)(dat[q]+=k,ad[q]+=k);
	int mid=l1+r1>>1;spread(q);
	change(q<<1,l1,mid,l,r,k),change(q<<1|1,mid+1,r1,l,r,k),dat[q]=wode::min(dat[q<<1],dat[q<<1|1]);
}
ll ask(int q,int l1,int r1,int l,int r) {
	if(l<=l1&&r1<=r) return dat[q];
	int mid=l1+r1>>1;spread(q);
	if(r<=mid) return ask(q<<1,l1,mid,l,r);
	else if(l>mid) return ask(q<<1|1,mid+1,r1,l,r);
	else return wode::min(ask(q<<1,l1,mid,l,r),ask(q<<1|1,mid+1,r1,l,r));
}
void dfs1(int x) {
	len[x]=1;
	for(res i=head[x];i;i=nxt[i]) d[ver[i]]=d[x]+edge[i],dfs1(ver[i]),len[x]+=len[ver[i]];
}
void dfs2(int x) {
	for(res i=head1[x];i;i=nxt1[i]) tot[ver1[i]]=ask(1,1,n,L[ver1[i]],R[ver1[i]]);
	for(res i=head[x];i;i=nxt[i]) {
		dat[1]+=edge[i],ad[1]+=edge[i],change(1,1,n,ver[i],len[ver[i]]+ver[i]-1,-(edge[i]<<1));
		dfs2(ver[i]);
		dat[1]-=edge[i],ad[1]-=edge[i],change(1,1,n,ver[i],len[ver[i]]+ver[i]-1,edge[i]<<1);
	}
}
inline void add(int x,int y,int z) {ver[++ans]=y,edge[ans]=z,nxt[ans]=head[x],head[x]=ans;}
inline void add1(int x,int y) {ver1[++ans1]=y,nxt1[ans1]=head1[x],head1[x]=ans1;}
int main()
{
	read(n),read(m);
	for(res i=2;i<=n;++i) read(x),read(y),add(x,i,y);
	for(res i=1;i<=m;++i) read(x),read(L[i]),read(R[i]),add1(x,i);
	dfs1(1);
	for(res i=1;i<=n;++i) change(1,1,n,i,i,len[i]==1?d[i]:1e18);
	dfs2(1);
	for(res i=1;i<=m;++i) print(tot[i],'\n');
	return 0;
}
/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?), set tle
    * do something instead of nothing and stay organized
*/