import java.io.*;
import java.util.*;
public class A{
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskE solver = new TaskE();
        solver.solve(1, in, out);
        out.flush();out.close();
    }
        static class TaskE {
            class pair{
                int F,S,T;
                pair(int a,int b){F=a;S=b;}
                pair(int a,int b,int c){F=a;S=b;T=c;}
            }
            int n,q;
            int start[],end[],euler[],T=-1;
            long dist[];
            boolean leave[];
            ArrayList<pair> al[];
            long seg[],lazy[],ans[];
            final long max=Long.MAX_VALUE;
            void dfs(int u){
                start[u]=++T;euler[T]=u;
                for(pair v:ja[u]){
                    leave[u]=false;
                    dist[v.F]=dist[u]+v.S;
                    dfs(v.F);
                }end[u]=T;
            }
            
            void upd(int n,int s,int e,int l,int r,long val){
                if(lazy[n]!=0){
                    updlazy(n,s,e);
                }
                if(s>r||e<l)return;
                if(s>=l&&e<=r){
                    lazy[n]=val;
                    updlazy(n,s,e);
                    return;
                }
                int m=(s+e)>>1;
                upd(2*n+1,s,m,l,r,val);upd(2*n+2,m+1,e,l,r,val);
                seg[n]=Math.min(seg[2*n+1],seg[2*n+2]);
            }
            void updlazy(int n,int s,int e){
                if(s==e&&!leave[euler[s]]){
                    seg[n]=max;
                    lazy[n]=0;
                    return;
                }
                seg[n]+=lazy[n];
                if(s!=e){
                    lazy[2*n+1]+=lazy[n];lazy[2*n+2]+=lazy[n];
                }
                lazy[n]=0;
            }
            long query(int n,int s,int e,int l,int r){
                if(lazy[n]!=0){
                    updlazy(n,s,e);
                }
                if(s>r||e<l)return max;
                if(s>=l&&e<=r)return seg[n];
                int m=(s+e)>>1;
                return Math.min(query(2*n+1,s,m,l,r),query(2*n+2,m+1,e,l,r));
            }
            void go(int u){
                for(int i=0;i<al[u].size();i++){
                    pair p=al[u].get(i);
                    ans[p.T]=query(0,0,n-1,p.F,p.S);
                }
                for(pair v:ja[u]){
                    upd(0,0,n-1,0,n-1,v.S);
                    upd(0,0,n-1,start[v.F],end[v.F],-2*v.S);
                    go(v.F);
                    upd(0,0,n-1,0,n-1,-v.S);
                    upd(0,0,n-1,start[v.F],end[v.F],2*v.S);
                }
            }
           public void solve(int testNumber, InputReader in, PrintWriter out) {
            n=in.nextInt();q=in.nextInt();
            make(n,n-1,in); 
            start=new int[n+1];end=new int[n+1];
            euler=new int[n+1];dist=new long[n+1];leave=new boolean[n+1];
            Arrays.fill(leave,true);
            dfs(1);
            al=new ArrayList[n+1];
            for(int i=0;i<=n;i++)al[i]=new ArrayList<>();
            for(int i=0;i<q;i++){
                int u=in.nextInt(),l=in.nextInt()-1,r=in.nextInt()-1;
                al[u].add(new pair(l,r,i));
            }
            seg=new long[4*n];lazy=new long[4*n];
            for(int i=1;i<=n;i++){
                upd(0,0,n-1,start[i],start[i],leave[i]?dist[i]:max);
            }
            ans=new long[q];
            go(1);
            for(int i=0;i<q;i++){
                out.println(ans[i]);
            }
          }
          pair ja[][];int from[],to[],c[],w[];
          void make(int n,int m,InputReader in){
            ja=new pair[n+1][];from=new int[m];to=new int[m];c=new int[n+1];w=new int[m];
            for(int i=0;i<m;i++){
                from[i]=in.nextInt();to[i]=i+2;w[i]=in.nextInt();
                c[from[i]]++;
            }
            for(int i=0;i<=n;i++){
                ja[i]=new pair[c[i]];c[i]=0;
            }
            for(int i=0;i<m;i++){
                ja[from[i]][c[from[i]]++]=new pair(to[i],w[i]);
            }
          }
    }
    static class InputReader {
        BufferedReader br;
        StringTokenizer st;
        public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}