import java.util.*;
import java.io.*;

public class F1 {
    static ArrayList<Integer> [] adj;
    static RangeTree seg;
    static long [] above;
    static ArrayList<Query> [] qq;
    static long [] dist, res;
    static int [] max;
    static int [] min;
    static int n;
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(null, null, "", (1 << 28)) {
            public void run() {
                solve();
            }
        };
        t.start();
        t.join();

    }

    static void solve() {
        MyScanner sc = new MyScanner();
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
        n = sc.nextInt();
        int q = sc.nextInt();
        above = new long[n + 1];
        adj = new ArrayList[n + 1];
        for (int i = 1; i <= n; i++) adj[i] = new ArrayList<>();
        seg = new RangeTree(n + 6);
        for (int i = 2; i <= n; i++) {
            int p = sc.nextInt();
            above[i] = sc.nextLong();
            adj[p].add(i); adj[i].add(p);
        }
        qq = new ArrayList[n + 1];
        for (int i = 1; i <= n; i++) qq[i] = new ArrayList<>();
        res = new long[q];
        for (int i = 0; i < q; i++) {
            qq[sc.nextInt()].add(new Query(sc.nextInt(), sc.nextInt(), i));
        }
        max = new int[n + 1]; min = new int[n + 1];
        Arrays.fill(min, Integer.MAX_VALUE);
        dist = new long[n + 1];
        dfs0(1, -1, 0);
        for (int i = 1; i <= n; i++) {
            if (adj[i].size() > 1) {
                seg.update(i, i, (long) 1e15);
            } else {
                seg.update(i, i, dist[i]);
            }
        }
        dfs(1, -1);
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < q; i++) sb.append(res[i] + "\n");
        out.println(sb.toString());
        out.close();
    }

    static void dfs0(int cur, int par, long to) {
        dist[cur] = to;
        for (Integer next: adj[cur]) {
            if (next != par) {
                dfs0(next, cur, to + above[next]);
                max[cur] = Math.max(max[cur], max[next]);
                min[cur] = Math.min(min[cur], min[next]);
            }
        }
        if (adj[cur].size() == 1) {
            max[cur] = cur;
            min[cur] = cur;
        }
    }

    static void dfs(int cur, int par) {
        for (Query query: qq[cur]) {
            res[query.i] = seg.minQuery(query.l, query.r);
        }
        for (Integer next: adj[cur]) {
            if (next != par) {
                seg.update(0, n + 4, above[next]);
                seg.update(min[next], max[next], -2 *above[next]);
                dfs(next, cur);
                seg.update(0, n + 4, -above[next]);
                seg.update(min[next], max[next], 2 * above[next]);
            }
        }
    }

    static class Query {
        int l; int r; int i;
        Query(int l, int r, int i) {
            this.l = l; this.r = r;
            this.i = i;
        }
    }

    static class RangeTree {
        private long[] min;
        private long[] lazy;
        private int size;
        public RangeTree(int size) {
            this.size = size;
            min = new long[4*size];
            lazy = new long[4*size];
        }
        public void update(int l, int r, long inc) {
            update(1, 0, size-1, l, r, inc);
        }
        private void pushDown(int index, int l, int r) {
            min[index] += lazy[index];
            if(l != r) {
                lazy[2*index] += lazy[index];
                lazy[2*index+1] += lazy[index];
            }
            lazy[index] = 0;
        }
        private void pullUp(int index, int l, int r) {
            int m = (l+r)/2;
            min[index] = Math.min(evaluateMin(2*index, l, m), evaluateMin(2*index+1, m+1, r));
        }
        private long evaluateMin(int index, int l, int r) {
            return min[index] + lazy[index];
        }
        private void update(int index, int l, int r, int left, int right, long inc) {
            if(r < left || l > right) return;
            if(l >= left && r <= right) {
                lazy[index] += inc;
                return;
            }
            pushDown(index, l, r);
            int m = (l+r)/2;
            update(2*index, l, m, left, right, inc);
            update(2*index+1, m+1, r, left, right, inc);
            pullUp(index, l, r);
        }
        public long minQuery(int l, int r) {
            return minQuery(1, 0, size-1, l, r);
        }
        private long minQuery(int index, int l, int r, int left, int right) {
            if(r < left || l > right) return Long.MAX_VALUE;
            if(l >= left && r <= right) {
                return evaluateMin(index, l, r);
            }
            pushDown(index, l, r);
            int m = (l+r)/2;
            long ret = Long.MAX_VALUE;
            ret = Math.min(ret, minQuery(2*index, l, m, left, right));
            ret = Math.min(ret, minQuery(2*index+1, m+1, r, left, right));
            pullUp(index, l, r);
            return ret;
        }
    }


    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

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

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }


    }

}