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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
import java.util.Arrays;

public class Fools_Roads {

    int maxn = 100010, inf = 1 << 28;

    class QTree {
        class node {
            node left, right, p;
            int idx, key, add;
            int rev;

            void init(int i) {
                left = right = p = nul;
                rev = key = add = 0;
                idx = i;
            }
        }

        node nul, nodes[] = new node[maxn];

        void init(int n) {
            nul = new node();
            nul.left = nul.right = nul.p = nul;
            for (int i = 1; i <= n; i++) {
                nodes[i] = new node();
                nodes[i].init(i);
            }
        }

        void pushdown(node x) {
            if (x == nul)
                return;
            if (x.add != 0) {
                x.left.add += x.add;
                x.right.add += x.add;
                x.key += x.add;
                x.add = 0;
            }
            if (x.rev != 0) {
                x.left.rev ^= 1;
                x.right.rev ^= 1;
                node temp = x.left;
                x.left = x.right;
                x.right = temp;
                x.rev = 0;
            }
        }

        void pushup(node x) {
            if (x == nul)
                return;
            pushdown(x.left);
            pushdown(x.right);
        }

        void leftrotate(node y) {
            node x = y.right, z = y.p;
            pushdown(y);
            pushdown(x);
            if (z != nul) {
                if (z.left == y)
                    z.left = x;
                else if (z.right == y)
                    z.right = x;
            }
            y.right = x.left;
            x.left = y;
            x.p = z;
            y.p = x;
            if (y.right != nul)
                y.right.p = y;
            pushup(y);
        }

        void rightrotate(node y) {
            node x = y.left, z = y.p;
            pushdown(y);
            pushdown(x);
            if (z != nul) {
                if (z.right == y)
                    z.right = x;
                else if (z.left == y)
                    z.left = x;
            }
            y.left = x.right;
            x.right = y;
            x.p = z;
            y.p = x;
            if (y.left != nul)
                y.left.p = y;
            pushup(y);
        }

        void splay(node x) {
            if (x == nul)
                return;
            nul.left = nul.right = nul.p = nul;
            pushdown(x);
            while (x.p.left == x || x.p.right == x) {
                if (x == x.p.left) {
                    if (x.p.p.left != x && x.p.p.right != x)
                        rightrotate(x.p);
                    else if (x.p == x.p.p.left) {
                        rightrotate(x.p.p);
                        rightrotate(x.p);
                    } else if (x.p == x.p.p.right) {
                        rightrotate(x.p);
                        leftrotate(x.p);
                    }
                } else {
                    if (x.p.p.left != x && x.p.p.right != x)
                        leftrotate(x.p);
                    else if (x.p == x.p.p.right) {
                        leftrotate(x.p.p);
                        leftrotate(x.p);
                    } else if (x.p == x.p.p.left) {
                        leftrotate(x.p);
                        rightrotate(x.p);
                    }
                }
            }
            pushup(x);
        }

        void access0(node x) {
            if (x.p != nul)
                access0(x.p);
            pushdown(x);
        }

        void access(node x) {
            access0(x);
            for (node v = nul, u = x; u != nul; u = u.p) {
                splay(u);
                u.left = v;
                v.p = u;
                v = u;
                pushup(v);
            }
            splay(x);
        }

        node findroot(node x) {
            access(x);
            while (x.right != nul) {
                pushdown(x.right);// different form Jesful
                x = x.right;
            }
            return x;
        }

        void changeroot(node x) {
            access(x);
            x.left = nul;
            pushup(x);
            x.rev ^= 1;
            pushdown(x);
        }

        void link(node son, node parent) {
            if (findroot(son) != son)// different form Jesful
                changeroot(son);
            access(son);
            access(parent);
            son.p = parent;
        }

        void addedge(int x, int y) {
            link(nodes[x], nodes[y]);
        }

        void update(node x, node y, int w) {
            access(x);
            for (node v = nul, u = y; u != nul; u = u.p) {
                splay(u);
                if (u.p == nul) {
                    u.left.add += w;
                    v.add += w;
                }
                u.left = v;
                v.p = u;
                pushup(v = u);
            }
        }
    }

    class node {
        int be, ne;

        node(int b, int e) {
            be = b;
            ne = e;
        }
    }

    node buf[] = new node[maxn * 2];
    int E[] = new int[maxn], len, fa[] = new int[maxn], n;
    int ans[] = new int[maxn];
    QTree tree = new QTree();

    void init() {
        len = 0;
        Arrays.fill(fa, -1);
        Arrays.fill(E, -1);
        tree.init(n);
    }

    void add(int a, int b) {
        buf[len] = new node(b, E[a]);
        E[a] = len++;
        buf[len] = new node(a, E[b]);
        E[b] = len++;
    }

    void dfs(int a, int f) {
        fa[a] = f;
        for (int i = E[a]; i != -1; i = buf[i].ne) {
            int b = buf[i].be;
            if (fa[b] == -1) {
                tree.addedge(b, a);
                dfs(b, a);
            }
        }
    }

    void run() throws IOException {
        n = nextInt();
        init();
        for (int i = 1; i < n; i++)
            add(nextInt(), nextInt());
        dfs(1, 1);
        int m = nextInt();
        while (m-- > 0) {
            int a = nextInt();
            int b = nextInt();
            tree.update(tree.nodes[a], tree.nodes[b], 1);
        }
        for (int i = 1; i <= n; i++) {
            tree.splay(tree.nodes[i]);
            ans[i] = tree.nodes[i].key;
        }
        for (int i = 0; i < len; i += 2) {
            int a = buf[i].be;
            int b = buf[i ^ 1].be;
            if (fa[a] == b)
                System.out.print(ans[a] + " ");
            else
                System.out.print(ans[b] + " ");
            System.out.println();
        }
    }

    StreamTokenizer in = new StreamTokenizer(new BufferedReader(
            new InputStreamReader(System.in)));

    int nextInt() throws IOException {
        in.nextToken();
        return (int) in.nval;
    }

    public static void main(String[] args) throws IOException {
        new Fools_Roads().run();
    }
}
