/*
Keep solving problems.
*/

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

public class CFA {
    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;
    private static final long MOD = 1000L * 1000L * 1000L + 7;
    private static final int[] dx = {0, -1, 0, 1};
    private static final int[] dy = {1, 0, -1, 0};
    private static final String yes = "Yes";
    private static final String no = "No";

    int n;
    int q;
    List<List<Edge>> graph = new ArrayList<>();
    List<List<Query>> queries = new ArrayList<>();
    int INDEX = 0;
    int[] startIndex;
    int[] endIndex;
    long[] res;
    long[] dist;
    long[] segTree;
    long[] lazy;
    long INF = Long.MAX_VALUE / 10;

    class Edge implements Comparable<Edge> {
        int from;
        int to;
        long weight;
        public Edge(int from, int to, long weight) {
            this.from = from;
            this.to = to;
            this.weight = weight;
        }

        @Override
        public int compareTo(Edge o) {
            return Integer.compare(to, o.to);
        }

        @Override
        public String toString() {
            return from + " " + to + " " + weight;
        }
    }

    class Query {
        int idx;
        int start;
        int end;
        public Query(int idx, int start, int end) {
            this.idx = idx;
            this.start = start;
            this.end = end;
        }
    }

    void build_tree(int node, int nodeStartIndex, int nodeEndIndex) {
        if(nodeStartIndex > nodeEndIndex) return; // Out of range
        if(nodeStartIndex == nodeEndIndex) { // Leaf node
            segTree[node] = isLeaf(nodeStartIndex) ? dist[startIndex[nodeStartIndex]] : INF; // Init value
            return;
        }

        build_tree(node * 2, nodeStartIndex, (nodeStartIndex + nodeEndIndex) / 2);
        build_tree(node * 2 + 1, 1 + (nodeStartIndex + nodeEndIndex) / 2, nodeEndIndex);
        segTree[node] = Math.min(segTree[node * 2], segTree[node * 2 + 1]);
    }

    /**
     * Increment elements within range [queryStartIndex, queryEndIndex] with value
     */
    void update_tree(int node, int nodeStartIndex, int nodeEndIndex, int queryStartIndex, int queryEndIndex, long value) {
        if(nodeStartIndex > nodeEndIndex || nodeStartIndex > queryEndIndex || nodeEndIndex < queryStartIndex) {
            // Current segment is not within range [i, j]
            return;
        }
        if(nodeStartIndex >= queryStartIndex && nodeEndIndex <= queryEndIndex) {
            // Segment is fully within range
            segTree[node] += value;
            lazy[node] += value;
            return;
        }

        //-------------
        shift(node, nodeStartIndex, nodeEndIndex);
        //-------------
        update_tree(node * 2, nodeStartIndex, (nodeStartIndex + nodeEndIndex) / 2, queryStartIndex, queryEndIndex, value);
        update_tree(node * 2 + 1, 1 + (nodeStartIndex + nodeEndIndex) / 2, nodeEndIndex, queryStartIndex, queryEndIndex, value);
        segTree[node] = Math.min(segTree[node * 2], segTree[node * 2 + 1]);
    }

    /**
     * Query tree to get max element value within range [queryStartIndex, queryEndIndex]
     */
    long query_tree(int node, int nodeStartIndex, int nodeEndIndex, int queryStartIndex, int queryEndIndex) {
        if(nodeStartIndex > nodeEndIndex || nodeStartIndex > queryEndIndex || nodeEndIndex < queryStartIndex) {
            // Out of range
            return INF;
        }
        if(nodeStartIndex >= queryStartIndex && nodeEndIndex <= queryEndIndex) {
            // Current segment is totally within range [i, j]
            return segTree[node];
        }

        //-------------
        shift(node, nodeStartIndex, nodeEndIndex);
        //-------------
        long q1 = query_tree(node * 2, nodeStartIndex, (nodeStartIndex + nodeEndIndex) / 2, queryStartIndex, queryEndIndex);
        long q2 = query_tree(1 + node * 2, 1 + (nodeStartIndex + nodeEndIndex) / 2, nodeEndIndex, queryStartIndex, queryEndIndex);
        return Math.min(q1, q2);
    }

    private void shift(int node, int nodeStartIndex, int nodeEndIndex) {
        if(lazy[node] != 0) { // This node needs to be updated
            int mid = (nodeStartIndex + nodeEndIndex) / 2;
            segTree[2 * node] += lazy[node];
            segTree[2 * node + 1] += lazy[node];

            lazy[node * 2] += lazy[node]; // Mark child as lazy
            lazy[node * 2 + 1] += lazy[node]; // Mark child as lazy
            lazy[node] = 0; // Reset it
        }
    }

    void solve() throws IOException {
        n = nextInt();
        q = nextInt();
        for (int i = 0; i < n; i++) {
            graph.add(new ArrayList<>());
        }
        for (int i = 0; i < n - 1; i++) {
            int from = nextInt() - 1;
            int to = i + 1;
            int weight = nextInt();
            graph.get(from).add(new Edge(from, to, weight));
            graph.get(to).add(new Edge(to, from, weight));
        }

        startIndex = new int[n];
        endIndex = new int[n];
        dist = new long[n];
        dfs(-1, 0, startIndex, endIndex, 0);
        for (int i = 0; i < n; i++) {
            queries.add(new ArrayList<>());
        }

        for (int i = 0; i < q; i++) {
            int v = nextInt() - 1;
            int l = nextInt() - 1;
            int r = nextInt() - 1;
            queries.get(v).add(new Query(i, l, r));
        }
        res = new long[q];
        segTree = new long[5 * n];
        lazy = new long[5 * n];
        build_tree(1, 0, n - 1);
        dfs(0, -1);

        for (int i = 0; i < q; i++) {
            outln(res[i]);
        }
    }

    void dfs(int cur, int parent) {
        for (Query q : queries.get(cur)) {
            res[q.idx] = query_tree(1, 0, n - 1, q.start, q.end);
        }

        for (Edge nxt : graph.get(cur)) {
            if (nxt.to != parent) {
                update_tree(1, 0, n - 1, 0, n - 1, nxt.weight);
                update_tree(1, 0, n - 1, startIndex[nxt.to], endIndex[nxt.to], (-2) * nxt.weight);

                dfs(nxt.to, cur);

                update_tree(1, 0, n - 1, 0, n - 1, -nxt.weight);
                update_tree(1, 0, n - 1, startIndex[nxt.to], endIndex[nxt.to], 2 * nxt.weight);
            }
        }
    }

    boolean isLeaf(int idx) {
        return idx != 0 && graph.get(idx).size() == 1;
    }

    // Euler's tour:
    void dfs(int parent, int nodeIndex, int[] startIndex, int[] endIndex, long d) {
        startIndex[nodeIndex] = INDEX;
        INDEX++;
        dist[nodeIndex] = d;
        for (Edge nxt : graph.get(nodeIndex)) {
            if (nxt.to != parent) {
                dfs(nodeIndex, nxt.to, startIndex, endIndex, d + nxt.weight);
            }
        }

        endIndex[nodeIndex] = INDEX - 1;
    }

    void shuffle(int[] a) {
        int n = a.length;
        for(int i = 0; i < n; i++) {
            int r = i + (int) (Math.random() * (n - i));
            int tmp = a[i];
            a[i] = a[r];
            a[r] = tmp;
        }
    }
    long gcd(long a, long b) {
        while(a != 0 && b != 0) {
            long c = b;
            b = a % b;
            a = c;
        }
        return a + b;
    }
    private void outln(Object o) {
        out.println(o);
    }
    private void out(Object o) {
        out.print(o);
    }
    private void formatPrint(double val) {
        outln(String.format("%.9f%n", val));
    }
    public CFA() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }
    public static void main(String[] args) throws IOException {
        new CFA();
    }

    public long[] nextLongArr(int n) throws IOException{
        long[] res = new long[n];
        for(int i = 0; i < n; i++)
            res[i] = nextLong();
        return res;
    }
    public int[] nextIntArr(int n) throws IOException {
        int[] res = new int[n];
        for(int i = 0; i < n; i++)
            res[i] = nextInt();
        return res;
    }
    public String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return null;
            }
        }
        return st.nextToken();
    }
    public String nextString() {
        try {
            return br.readLine();
        } catch (IOException e) {
            eof = true;
            return null;
        }
    }
    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
}