import java.lang.*;
import java.math.*;
import java.util.*;
import java.io.*;

public class Main {
    class Node implements Comparable<Node>{
        int x;
        long w;
        public Node(int id,long w){
            this.x=id;
            this.w=w;
        }
        public int compareTo(Node c){
            return Integer.compare(this.x,c.x);
        }
    }
    class Node2 {
        int id;
        int l;
        int r;
        public Node2(int id,int l,int r){
            this.id=id;
            this.l=l;
            this.r=r;
        }

    }

    void solve() {
         n=ni(); int q=ni();
        int from[]=new int[n-1];
        int to[]=new int[n-1];
        long w[]=new long[n-1];
        for(int i=2;i<=n;i++){
            from[i-2]=i; to[i-2]=ni(); w[i-2]=nl();
        }
        g=pachUW(from,to,w,n,n-1);
        for(int i=1;i<=n;i++) Arrays.sort(g[i]);
        ed=new int[n+1];
        a=new long[n+1];
        Arrays.fill(a,Long.MAX_VALUE);
        dfs(1,-1,0);
        int query[][]=new int[q+1][3];
        int sz[]=new int[n+1];
        for(int i=1;i<=q;i++) {
            for(int j=0;j<3;j++) query[i][j]=ni();
            sz[query[i][0]]++;
        }
        vec=new Node2[n+1][];
        for(int i=1;i<=n;i++) vec[i]=new Node2[sz[i]];
        Arrays.fill(sz,0);
        for(int i=1;i<=q;i++){
            int v=query[i][0],l=query[i][1],r=query[i][2];
            vec[v][sz[v]++]=new Node2(i,l,r);
        }
        ans=new long[q+1];
        tree=new long[4*n+1];
        lazy=new long[4*n+1];

        build(1,1,n);
       // pw.println(query(1,5,5,1,n));
        dfs2(1,-1);
        for(int i=1;i<=q;i++) pw.println(ans[i]);

    }
    int n;
    long ans[];
    int ed[];
    int tme=0;
    Node g[][];
    Node2 vec[][];
    long a[];
    long tree[];
    long lazy[];
    void dfs(int v,int pr,long d){
        ++tme;
        boolean is=false;
        for(Node p : g[v]){
            if(p.x!=pr){
                dfs(p.x,v,d+p.w);
                is=true;
            }
        }
        if(!is) a[v]=d;
        ed[v]=tme;
    }
    void dfs2(int v,int pr){
        for(Node2 p : vec[v]){
          //  pw.println(v+" "+p.id+" "+p.l+" "+p.r);
            ans[p.id]=query(1,p.l,p.r,1,n);
        }
        for(Node p : g[v]){
            if(p.x==pr) continue;
            int u=p.x; long w=p.w;
            update(1,1,n,1,n,w);
            update(1,u,ed[u],1,n,-2*w);
          //  pw.println(u+" "+ed[u]);
            dfs2(u,v);
            update(1,1,n,1,n,-w);
            update(1,u,ed[u],1,n,2*w);

        }
    }
    void build(int id,int l,int r){
        if(l==r){
            tree[id]=a[l];
        }else {
            int mid=(l+r)>>1;
            build(2*id,l,mid);
            build(2*id+1,mid+1,r);
            tree[id]=Math.min(tree[2*id],tree[2*id+1]);
        }
    }
    void update(int id,int x,int y,int l,int r,long w){
        push(id,l,r);
        if(r<x || l>y) return;
        if(x<=l && r<=y){
            if(tree[id]!=Long.MAX_VALUE) tree[id]+=w;
            if(l!=r){
                lazy[2*id]+=w;
                lazy[2*id+1]+=w;
            }
            return;
        }
        int mid=(l+r)>>1;
        update(2*id,x,y,l,mid,w);
        update(2*id+1,x,y,mid+1,r,w);
        tree[id]=Math.min(tree[2*id],tree[2*id+1]);
    }
    long query(int id,int x,int y,int l,int r){
        push(id,l,r);
        if(r<x || l>y) return Long.MAX_VALUE;
        if(x<=l && r<=y) return tree[id];
        int mid=(l+r)>>1;
        return Math.min(query(2*id,x,y,l,mid),query(2*id+1,x,y,mid+1,r));
    }
    void push(int id,int l,int r){
        if(lazy[id]==0) return;
        if(tree[id]!=Long.MAX_VALUE) tree[id]+=lazy[id];
        if(l!=r){
            lazy[2*id]+=lazy[id];
            lazy[2*id+1]+=lazy[id];

        }
        lazy[id]=0;
    }



    Node [][] pachUW(int from[],int to[],long w[],int n,int m){

        int sz[]=new int[n+1];
        for(int i=0;i<m;i++) {
            sz[from[i]]++;
            sz[to[i]]++;
        }
        Node g[][]=new Node[n+1][];
        for(int i=1;i<=n;i++){
            g[i]=new Node[sz[i]];
        }
        for(int i=0;i<m;i++){
            int x=from[i],y=to[i];
            g[x][--sz[x]]=new Node(y,w[i]);
            g[y][--sz[y]]=new Node(x,w[i]);
        }
        return g;
    }


    long add(long a,long b){
        a+=b;
        if(a>=M) a-=M;
        return a;
    }
    long sub(long a,long b){
        a-=b;
        if(a<0) a+=M;
        return a;
    }
    long mul(long a,long b){
        a*=b;
        if(a>=M) a%=M;
        return a;
    }
    long modpow(long a, long b,long M)
    {
        long r=1;
        while(b>0)
        {
            if((b&1)>0) r=mul(r,a);
            a=mul(a,a);
            b>>=1;
        }
        return r;
    }

    long modInverse(long A, long M)
    {

        return modpow(A,M-2,M);
    }

    long M = (long)1e9+7;
    InputStream is;
    PrintWriter pw;
    String INPUT = "";

    void run() throws Exception {
        is = is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
        pw = new PrintWriter(System.out);

        Thread t = new Thread(null, null, "~", Runtime.getRuntime().maxMemory()){
            @Override
            public void run() {
                long s = System.currentTimeMillis();
                solve();

                pw.flush();
                if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
            }
        };
        t.start();
        t.join();

    }

    public static void main(String[] args) throws Exception {
        new Main().run();
    }

    private byte[] inbuf = new byte[1024];
    public int lenbuf = 0, ptrbuf = 0;

    private int readByte() {
        if (lenbuf == -1) throw new InputMismatchException();
        if (ptrbuf >= lenbuf) {
            ptrbuf = 0;
            try {
                lenbuf = is.read(inbuf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (lenbuf <= 0) return -1;
        }
        return inbuf[ptrbuf++];
    }

    private boolean isSpaceChar(int c) {
        return !(c >= 33 && c <= 126);
    }

    private int skip() {
        int b;
        while ((b = readByte()) != -1 && isSpaceChar(b)) ;
        return b;
    }

    private double nd() {
        return Double.parseDouble(ns());
    }

    private char nc() {
        return (char) skip();
    }

    private String ns() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private char[] ns(int n) {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while (p < n && !(isSpaceChar(b))) {
            buf[p++] = (char) b;
            b = readByte();
        }
        return n == p ? buf : Arrays.copyOf(buf, p);
    }

    private char[][] nm(int n, int m) {
        char[][] map = new char[n][];
        for (int i = 0; i < n; i++) map[i] = ns(m);
        return map;
    }

    private int[] na(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = ni();
        return a;
    }

    private int ni() {
        int num = 0, b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
        if (b == '-') {
            minus = true;
            b = readByte();
        }

        while (true) {
            if (b >= '0' && b <= '9') {
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private long nl() {
        long num = 0;
        int b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
        if (b == '-') {
            minus = true;
            b = readByte();
        }

        while (true) {
            if (b >= '0' && b <= '9') {
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private boolean oj = System.getProperty("ONLINE_JUDGE") != null;

    private void tr(Object... o) {
        if (INPUT.length() > 0) System.out.println(Arrays.deepToString(o));
    }

}