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.
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskE solver = new TaskE();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskE {
        int[] depth;
        int[][] parent;
        ArrayList<Integer>[] G;
        int root;
        int log;
        int V;
        int[] cost;

        void LCA(int V) {
            this.V = V;
            G = new ArrayList[V];
            for (int i = 0; i < V; i++) {
                G[i] = new ArrayList<Integer>();
            }
            for (log = 0; (1 << log) < V; log++) ;
        }

        void dfs(int v, int p, int d) {
            parent[0][v] = p;
            depth[v] = d;
            for (int i = 0; i < G[v].size(); i++) {
                if (G[v].get(i) != p) {
                    dfs(G[v].get(i), v, d + 1);
                }
            }
        }

        void init(int root) {
            parent = new int[log][V];
            depth = new int[V];
            this.root = root;

            //dfs through parents[2^0] and depth
            dfs(root, -1, 0);

            for (int k = 0; k + 1 < log; k++) {
                for (int v = 0; v < V; v++) {
                    if (parent[k][v] < 0) {
                        parent[k + 1][v] = -1;
                    } else {
                        parent[k + 1][v] = parent[k][parent[k][v]];
                    }
                }
            }

        }

        int lca(int u, int v) {
            if (depth[u] > depth[v]) {
                u ^= v;
                v ^= u;
                u ^= v;
            }

            //Now v is on the deeper level

            for (int k = 0; k < log; k++) {
                if (((depth[v] - depth[u]) >> k & 1) == 1) {
                    v = parent[k][v];
                }
            }

            if (u == v) return u;

            for (int k = log - 1; k >= 0; k--) {
                if (parent[k][u] != parent[k][v]) {
                    u = parent[k][u];
                    v = parent[k][v];
                }
            }
            return parent[0][u];
        }

        void addEdge(int u, int v) {
            G[u].add(v);
            G[v].add(u);
        }

        int dfs(int node) {
            int c = cost[node];
            for (int i = 0; i < G[node].size(); i++) {
                if (G[node].get(i) != parent[0][node]) {
                    c += dfs(G[node].get(i));
                }
            }
            cost[node] = c;
            return c;
        }

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            LCA(n);
            int[] a = new int[n - 1];
            int[] b = new int[n - 1];
            for (int i = 0; i < n - 1; i++) {
                a[i] = in.nextInt() - 1;
                b[i] = in.nextInt() - 1;
                addEdge(a[i], b[i]);
            }
            init(0);
            int q = in.nextInt();
            cost = new int[n];
            for (int c = 0; c < q; c++) {
                int x = in.nextInt() - 1;
                int y = in.nextInt() - 1;
                int anc = lca(x, y);
                cost[x] += 1;
                cost[y] += 1;
                cost[anc] -= 2;
            }

            dfs(0);

            for (int i = 0; i < n - 1; i++) {
                if (a[i] == parent[0][b[i]]) {
                    out.print(cost[b[i]] + " ");
                } else {
                    out.print(cost[a[i]] + " ");
                }
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}

