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

public class E implements Runnable {
	FastReader scn;
	PrintWriter out;
	String INPUT = "5 3\r\n" + 
			"1 10\r\n" + 
			"1 1\r\n" + 
			"3 2\r\n" + 
			"3 3\r\n" + 
			"1 1 5\r\n" + 
			"5 4 5\r\n" + 
			"4 1 2\r\n" + 
			"";

	int time = 0;
	long inf = (long) (1e18 + 1e9);
	int[]  st, en;
	long[] seg, lazy;
	
	void solve() {
		int n = scn.nextInt(), Q = scn.nextInt();
		int[] par = new int[n], w = new int[n];
		for(int i = 1; i < n; i++) {
			par[i] = scn.nextInt() - 1;
			w[i] = scn.nextInt();
		}
		par[0] = -1;
		int[][][] g = parentToGW(par, w);
		for(int i = 0; i < n; i++) {
			Arrays.sort(g[i], (o1, o2) -> o1[0] - o2[0]);
		}
		st = new int[n];
		en = new int[n];
		
		seg = new long[4 * n];
		lazy = new long[4 * n];
		
		long[] arr = new long[n];
		dfs(g, 0, -1, 0, arr);
		build(0, 0, n - 1, arr);
		int[] count = new int[n];
		int[][] qr = new int[Q][];
		for(int i = 0; i < Q; i++) {
			qr[i] = new int[] {scn.nextInt() - 1, scn.nextInt() - 1, scn.nextInt() - 1, i};
			count[qr[i][0]]++;
		}
		
		int[][][] need = new int[n][][];
		for(int i = 0; i < n; i++) {
			need[i] = new int[count[i]][3];
		}
		
		for(int[] q : qr) {
			need[q[0]][count[q[0]] - 1][0] = q[1];
			need[q[0]][count[q[0]] - 1][1] = q[2];
			need[q[0]][count[q[0]] - 1][2] = q[3];
			count[q[0]]--;
		}
		
		long[] ans = new long[Q];
		func(g, need, ans, 0, -1);
		for(long x : ans) {
			out.println(x);
		}
	}
	
	void func(int[][][] g, int[][][] need, long[] ans, int u, int p) {
		for(int[] q : need[u]) {
			int l = q[0], r = q[1], ind = q[2];
			ans[ind] = query(0, 0, g.length - 1, l, r);
		}
		
		for(int[] v : g[u]) {
			if(v[0] != p) {
				update(0, 0, g.length - 1, 0, g.length - 1, v[1]);
				update(0, 0, g.length - 1, st[v[0]], en[v[0]], -2 * v[1]);
				
				func(g, need, ans, v[0], u);
				
				update(0, 0, g.length - 1, 0, g.length - 1, -v[1]);
				update(0, 0, g.length - 1, st[v[0]], en[v[0]], 2 * v[1]);
			}
		}
	}
	
	void dfs(int[][][] g, int u, int p, long d, long[] arr) {
		st[u] = time++;
		for(int[] v : g[u]) {
			if(v[0] != p) {
				dfs(g, v[0], u, d + v[1], arr);
			}
		}
		en[u] = time - 1;
		
		if(g[u].length == 1 && p != -1) {
			arr[st[u]] = d;
		} else {
			arr[st[u]] = inf;
		}
	}
	
	long query(int ind, int l, int r, int si, int li) {
		push(ind, l, r, lazy[ind]);
		if(si > r || li < l) {
			return inf;
		}
		if(l >= si && r <= li) {
			return seg[ind];
		}
		
		int m = (l + r) >> 1;
		long x = query(2 * ind + 1, l, m, si, li);
		long y = query(2 * ind + 2, m + 1, r, si, li);
		return Math.min(x, y);
	}
	
	void update(int ind, int l, int r, int si, int li, long val) {
		push(ind, l, r, lazy[ind]);
		if(si > r || li < l) {
			return;
		}
		if(l >= si && r <= li) {
			push(ind, l, r, val);
			return;
		}
		
		int m = (l + r) >> 1;
		update(2 * ind + 1, l, m, si, li, val);
		update(2 * ind + 2, m + 1, r, si, li, val);
		seg[ind] = Math.min(seg[2 * ind + 1], seg[2 * ind + 2]);
	}
	
	void build(int ind, int l, int r, long[] arr) {
		if(l == r) {
			seg[ind] = arr[l];
			return;
		}
		int m = (l + r) >> 1;
		build(2 * ind + 1, l, m, arr);
		build(2 * ind + 2, m + 1, r, arr);
		seg[ind] = Math.min(seg[2 * ind + 1], seg[2 * ind + 2]);
	}
	
	void push(int ind, int l, int r, long val) {
		seg[ind] += val;
		if(l != r) {
			lazy[2 * ind + 1] += val;
			lazy[2 * ind + 2] += val;
		}
		lazy[ind] = 0;
	}
	
	int[][][] parentToGW(int[] par, int[] w) {
		int n = par.length;
		int[] ct = new int[n];
		for (int i = 0; i < n; i++) {
			if (par[i] >= 0) {
				ct[i]++;
				ct[par[i]]++;
			}
		}
		int[][][] g = new int[n][][];
		for (int i = 0; i < n; i++) {
			g[i] = new int[ct[i]][2];
		}
		for (int i = 0; i < n; i++) {
			if (par[i] >= 0) {
				g[par[i]][ct[par[i]] - 1][0] = i;
				g[par[i]][ct[par[i]] - 1][1] = w[i];
				--ct[par[i]];
				g[i][ct[i] - 1][0] = par[i];
				g[i][ct[i] - 1][1] = w[i];
				--ct[i];
			}
		}
		return g;
	}

	public void run() {
		long time = System.currentTimeMillis();
		boolean oj = System.getProperty("ONLINE_JUDGE") != null;
		out = new PrintWriter(System.out);
		scn = new FastReader(oj);
		solve();
		out.flush();
		if (!oj) {
			System.out.println(Arrays.deepToString(new Object[] { System.currentTimeMillis() - time + " ms" }));
		}
	}

	public static void main(String[] args) {
		new Thread(null, new E(), "Main", 1 << 26).start();
	}

	class FastReader {
		InputStream is;

		public FastReader(boolean onlineJudge) {
			is = onlineJudge ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		}

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

		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++];
		}

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

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

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

		char nextChar() {
			return (char) skip();
		}

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

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

		char[] next(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);
		}

		int nextInt() {
			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();
			}
		}

		long nextLong() {
			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();
			}
		}

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

		int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		int[][] next2DInt(int n, int m) {
			int[][] arr = new int[n][];
			for (int i = 0; i < n; i++) {
				arr[i] = nextIntArray(m);
			}
			return arr;
		}

		long[][] next2DLong(int n, int m) {
			long[][] arr = new long[n][];
			for (int i = 0; i < n; i++) {
				arr[i] = nextLongArray(m);
			}
			return arr;
		}

		int[] shuffle(int[] arr) {
			Random r = new Random();
			for (int i = 1, j; i < arr.length; i++) {
				j = r.nextInt(i);
				arr[i] = arr[i] ^ arr[j];
				arr[j] = arr[i] ^ arr[j];
				arr[i] = arr[i] ^ arr[j];
			}
			return arr;
		}

		int[] uniq(int[] arr) {
			Arrays.sort(arr);
			int[] rv = new int[arr.length];
			int pos = 0;
			rv[pos++] = arr[0];
			for (int i = 1; i < arr.length; i++) {
				if (arr[i] != arr[i - 1]) {
					rv[pos++] = arr[i];
				}
			}
			return Arrays.copyOf(rv, pos);
		}
		
		int[] reverse(int[] arr) {
			int l = 0, r = arr.length - 1;
			while (l < r) {
				arr[l] = arr[l] ^ arr[r];
				arr[r] = arr[l] ^ arr[r];
				arr[l] = arr[l] ^ arr[r];
				l++;
				r--;
			}
			return arr;
		}

	}
}