They say that Berland has exactly two problems, fools and roads. Besides, Berland has n cities, populated by the fools and connected by the roads. All Berland roads are bidirectional. As there are many fools in Berland, between each pair of cities there is a path (or else the fools would get upset). Also, between each pair of cities there is no more than one simple path (or else the fools would get lost). 

But that is not the end of Berland's special features. In this country fools sometimes visit each other and thus spoil the roads. The fools aren't very smart, so they always use only the simple paths.

A simple path is the path which goes through every Berland city not more than once.

The Berland government knows the paths which the fools use. Help the government count for each road, how many distinct fools can go on it.

Note how the fools' paths are given in the input.

Input

The first line contains a single integer n (2 ≤ n ≤ 105) — the number of cities. 

Each of the next n - 1 lines contains two space-separated integers ui, vi (1 ≤ ui, vi ≤ n, ui ≠ vi), that means that there is a road connecting cities ui and vi. 

The next line contains integer k (0 ≤ k ≤ 105) — the number of pairs of fools who visit each other. 

Next k lines contain two space-separated numbers. The i-th line (i > 0) contains numbers ai, bi (1 ≤ ai, bi ≤ n). That means that the fool number 2i - 1 lives in city ai and visits the fool number 2i, who lives in city bi. The given pairs describe simple paths, because between every pair of cities there is only one simple path.

Output

Print n - 1 integer. The integers should be separated by spaces. The i-th number should equal the number of fools who can go on the i-th road. The roads are numbered starting from one in the order, in which they occur in the input.

Examples

Input

5
1 2
1 3
2 4
2 5
2
1 4
3 5


Output

2 1 1 1 


Input

5
3 4
4 5
1 4
2 4
3
2 3
1 3
3 5


Output

3 1 1 1 

Note

In the first sample the fool number one goes on the first and third road and the fool number 3 goes on the second, first and fourth ones.

In the second sample, the fools number 1, 3 and 5 go on the first road, the fool number 5 will go on the second road, on the third road goes the fool number 3, and on the fourth one goes fool number 1.
/**
 * DA-IICT
 * Author : Savaliya Sagar
 */
import java.io.*;
import java.math.*;
import java.util.*;

public class Fools_Roads {

	public static int mod = 1000000007;
	public static FasterScanner in = new FasterScanner();
	public static PrintWriter o = new PrintWriter(System.out);
	public static int count[];
	public static int ans[];
	public static void main(String[] args) {
		new Thread(null, new Runnable() {
			public void run() {
				try {
					Solve();
					o.close();
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		}, "1", 1 << 26).start();
	}

	public static void Solve() {
		int n = in.nextInt();
		Tree t = new Tree(n);
		int k = in.nextInt();
		count = new int[n+1];
		ans = new int[n-1];
		while(k-->0){
			int u = in.nextInt();
			int v = in.nextInt();
			int w = t.lca(u, v);
			count[u]++;
			count[v]++;
			count[w]-=2;
		}
		t._dfs(1, -1);
		t.fun(1, -1);
		for(int f:ans)
			o.print(f + " ");
	}

	static class Tree {
		ArrayList<ArrayList<Pair>> g = new ArrayList<>();
		int T[]; // parent
		int L[]; // level
		int P[][]; // P[i][j] = 2^j th parent of i

		public Tree(int n) {
			T = new int[n + 1];
			L = new int[n + 1];
			P = new int[n + 1][log2(n) + 1];
			L[1] = 0;
			for (int i = 0; i <= n; i++) {
				g.add(new ArrayList<>());
			}
			for (int i = 0; i < n-1 ; i++) {
				int a = in.nextInt();
				int b = in.nextInt();
				g.get(a).add(new Pair(b,i));
				g.get(b).add(new Pair(a,i));
			}
			dfs(1, -1);
			for (int j = 0; (1 << j) <= n; j++)
				pre(1, j,-1);
		}

		public int log2(int n) {
			return (int) (Math.log10(n) / Math.log10(2));
		}

		public void dfs(int node, int p) {
			for (Pair k : g.get(node)) {
				if (k.v != p) {
					T[k.v] = node;
					L[k.v] = L[node] + 1;
					dfs(k.v, node);
				}
			}
		}
		
		public void _dfs(int node,int p){
			for (Pair k : g.get(node)) {
				if (k.v != p) {
					_dfs(k.v, node);
					count[node] += count[k.v];  
				}
			}
		}
		
		public void fun(int node,int p){
			for (Pair k : g.get(node)) {
				if (k.v != p) {
					ans[k.w]=count[k.v];
					fun(k.v, node);
				}
			}
		}
		public void pre(int node, int j,int p) {
			if (j == 0) {
				P[node][j] = T[node];
			} else {
				P[node][j] = P[P[node][j - 1]][j - 1];
			}
			for (Pair k : g.get(node)) {
				if(k.v!=p)
					pre(k.v, j,node);
			}
		}

		public int lca(int u, int v) {
			if (L[u] > L[v]) {
				int temp = u;
				u = v;
				v = temp;
			}
			int log;
			for (log = 0; (1 << log) <= L[v]; log++)
				; // convert level into log
			log--;

			for (int i = log; i >= 0; i--) {
				if ((1 << i) <= L[v] - L[u]) // make both node's level same
					v = P[v][i];
			}
			if (u == v)
				return u;
			for (int i = log; i >= 0; i--) {
				if (P[u][i] != 0 && P[u][i] != P[v][i]) // shift up both u and v
				{
					u = P[u][i];
					v = P[v][i];
				}
			}
			return T[u];
		}
	}

	public static class Pair{
		int v;
		int w;
		Pair(int x,int y){
			this.v = x;
			this.w = y;
		}
	}
	public static void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	static class FasterScanner {
		private byte[] buf = new byte[1024];
		private int curChar;
		private int snumChars;

		public int read() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = System.in.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

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

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

		private boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}
	}
}
