Vasya has a tree consisting of n vertices with root in vertex 1. At first all vertices has 0 written on it.

Let d(i, j) be the distance between vertices i and j, i.e. number of edges in the shortest path from i to j. Also, let's denote k-subtree of vertex x — set of vertices y such that next two conditions are met: 

  * x is the ancestor of y (each vertex is the ancestor of itself); 
  * d(x, y) ≤ k. 



Vasya needs you to process m queries. The i-th query is a triple v_i, d_i and x_i. For each query Vasya adds value x_i to each vertex from d_i-subtree of v_i.

Report to Vasya all values, written on vertices of the tree after processing all queries.

Input

The first line contains single integer n (1 ≤ n ≤ 3 ⋅ 10^5) — number of vertices in the tree.

Each of next n - 1 lines contains two integers x and y (1 ≤ x, y ≤ n) — edge between vertices x and y. It is guarantied that given graph is a tree.

Next line contains single integer m (1 ≤ m ≤ 3 ⋅ 10^5) — number of queries.

Each of next m lines contains three integers v_i, d_i, x_i (1 ≤ v_i ≤ n, 0 ≤ d_i ≤ 10^9, 1 ≤ x_i ≤ 10^9) — description of the i-th query.

Output

Print n integers. The i-th integers is the value, written in the i-th vertex after processing all queries.

Examples

Input


5
1 2
1 3
2 4
2 5
3
1 1 1
2 0 10
4 10 100


Output


1 11 1 100 0 


Input


5
2 3
2 1
5 4
3 4
5
2 0 4
3 10 1
1 2 3
2 3 10
1 1 7


Output


10 24 14 11 11 

Note

In the first exapmle initial values in vertices are 0, 0, 0, 0, 0. After the first query values will be equal to 1, 1, 1, 0, 0. After the second query values will be equal to 1, 11, 1, 0, 0. After the third query values will be equal to 1, 11, 1, 100, 0.
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

public class E {
	IO io = new IO();
	int N;
	long[] dec;
	List<Integer> edges[];
	List<Triplet> ts[];
	long[] ans;
	
	void begin() {
		N = io.nextInt();
		dec = new long[N];
		ans = new long[N];
		edges = new List[N];
		ts = new List[N];
		
		for(int i=0; i<N; i++) { 
			edges[i] = new ArrayList<>();
			ts[i] = new ArrayList<>();
		}
		
		for(int i=1; i<N; i++) {
			int a = io.nextInt() - 1;
			int b = io.nextInt() - 1;
			edges[a].add(b);
			edges[b].add(a);
		}
		
		int Q = io.nextInt();
		for(int i=0; i<Q; i++) {
			int node = io.nextInt() - 1;
			int range = io.nextInt();
			long add = io.nextLong();
			ts[node].add(new Triplet(range, add));
		}
		
		rec(0, -1, 0, 0);
		for(int i=0; i<N-1; i++) {
			io.out("%d ", ans[i]);
		}
		io.out("%d\n", ans[N-1]);
		
		io.done();
	}
	
	void rec(int node, int par, int lv, long give) {
		ans[node] = give - dec[lv];
		for(Triplet t : ts[node]) {
			ans[node] += t.add;
			int rg = lv + t.range + 1;
			if(rg < N) {
				dec[lv + t.range + 1] += t.add;
			}
		}
		
		for(int to : edges[node]) {
			if(to == par) continue;
			rec(to, node, lv+1, ans[node]);
		}
		
		for(Triplet t : ts[node]) {
			int rg = lv + t.range + 1;
			if(rg < N) {
				dec[lv + t.range + 1] -= t.add;
			}
		}
	}
	
	static class Triplet {
		int range;
		long add;
		
		public Triplet(int range, long add) {
			this.range = range;
			this.add = add;
		}
	}
	
	public static void main(String[] args) {
		(new E()).begin();
	}
	
	static class IO {
		BufferedReader reader;
		StringTokenizer tokenizer;
		BufferedWriter writer;
		boolean isAutoFlush;
		
		public IO() {
			this(false, null, null);
		}
		
		public IO(boolean isAutoFlush, String fileFrom, String fileTo) {
			if(fileFrom == null) {
				reader = new BufferedReader(new InputStreamReader(System.in));
			} else {
				try {
					reader = new BufferedReader(new FileReader(new File(fileFrom)));
				} catch(IOException e) {
					throw new RuntimeException(e);
				}
			}
			
			if(fileTo == null) {
				writer = new BufferedWriter(new OutputStreamWriter(System.out));
			} else {
				try {
					writer = new BufferedWriter(new FileWriter(new File(fileTo)));
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			
			tokenizer = new StringTokenizer("");
		}
		
		private String next() {
			while (!tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) { //EOF
					e.printStackTrace();
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public String nextString() {
			return next();
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		
		public void out(String format, Object... args) {
			try {
				String string = String.format(format, args);
				writer.write(string);
				if(isAutoFlush) writer.flush();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		
		public void done() {
			try {
				writer.flush();
				reader.close();
				writer.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}

}
