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.Collection;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.NoSuchElementException;
import java.io.InputStream;

/**
 * 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);
        FoolsAndRoads solver = new FoolsAndRoads();
        solver.solve(1, in, out);
        out.close();
    }

    static class FoolsAndRoads {
        int n;
        int k;
        int[][] adj;
        int[] from;
        int[] to;
        int[] val;
        int[][] a;

        void dfs(int u, int par) {
            for (int v : adj[u]) {
                if (v != par) {
                    dfs(v, u);
                    val[u] += val[v];
                }
            }
        }

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            n = in.nextInt();
            from = new int[n - 1];
            to = new int[n - 1];
            for (int i = 0; i < n - 1; i++) {
                int u = in.nextInt();
                int v = in.nextInt();
                from[i] = u;
                to[i] = v;
            }
            adj = GraphUtils.packU(n + 1, from, to);
            k = in.nextInt();
            a = new int[2][k];
            for (int i = 0; i < k; i++) {
                a[0][i] = in.nextInt();
                a[1][i] = in.nextInt();
            }

            FoolsAndRoads.LCA lca = new FoolsAndRoads.LCA(adj);
            val = new int[n + 1];
            for (int i = 0; i < k; i++) {
                int u = a[0][i];
                int v = a[1][i];
                val[u]++;
                val[v]++;
                val[lca.lca(u, v)] -= 2;
            }
            dfs(1, -1);

            for (int i = 0; i < n - 1; i++) {
                int u = from[i];
                int v = to[i];
                if (lca.depth[u] < lca.depth[v]) {
                    u = v;
                }
                out.print(val[u] + " ");
            }
            out.println();
        }

        static class LCA {
            int[] tree;
            int[] first;
            int[] depth;
            EzIntArrayList tour;

            LCA(int[][] adj) {
                int n = adj.length - 1;
                first = new int[n + 1];
                depth = new int[n + 1];
                tour = new EzIntArrayList(2 * n);
                dfs(adj, 1, -1, 0);
                tree = new int[4 * tour.size()];
                build(1, 0, tour.size() - 1);
            }

            int lca(int u, int v) {
                int iu = first[u];
                int iv = first[v];
                if (iu > iv) {
                    int temp = iu;
                    iu = iv;
                    iv = temp;
                }
                return query(1, 0, tour.size() - 1, iu, iv);
            }

            void dfs(int[][] adj, int u, int par, int dep) {
                depth[u] = dep;
                first[u] = tour.size();
                tour.add(u);
                for (int v : adj[u]) {
                    if (v != par) {
                        dfs(adj, v, u, dep + 1);
                        tour.add(u);
                    }
                }
            }

            void build(int v, int tl, int tr) {
                if (tl == tr) {
                    tree[v] = tour.get(tl);
                } else {
                    int tm = (tl + tr) / 2;
                    build(2 * v, tl, tm);
                    build(2 * v + 1, tm + 1, tr);
                    int lv = tree[2 * v];
                    int rv = tree[2 * v + 1];
                    tree[v] = (depth[lv] < depth[rv]) ? lv : rv;
                }
            }

            int query(int v, int tl, int tr, int l, int r) {
                if (l > r) {
                    return -1;
                } else if (tl == l && tr == r) {
                    return tree[v];
                } else {
                    int tm = (tl + tr) / 2;
                    int lv = query(2 * v, tl, tm, l, Math.min(tm, r));
                    int rv = query(2 * v + 1, tm + 1, tr, Math.max(tm + 1, l), r);
                    if (lv == -1) {
                        return rv;
                    } else if (rv == -1) {
                        return lv;
                    } else {
                        return (depth[lv] < depth[rv]) ? lv : rv;
                    }
                }
            }

        }

    }

    static class InputReader {
        private final InputStream is;
        private final byte[] inbuf = new byte[1024];
        private int lenbuf = 0;
        private int ptrbuf = 0;

        public InputReader(InputStream stream) {
            is = stream;
        }

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

        public 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();
            }
        }

    }

    static interface EzIntList extends EzIntCollection {
        int size();

        EzIntIterator iterator();

        boolean equals(Object object);

        int hashCode();

        String toString();

    }

    static interface EzIntCollection {
        int size();

        EzIntIterator iterator();

        boolean equals(Object object);

        int hashCode();

        String toString();

    }

    static class GraphUtils {
        public static int[][] packU(int n, int[] from, int[] to) {
            int[][] g = new int[n][];
            int[] p = new int[n];
            for (int f : from) {
                p[f]++;
            }
            for (int t : to) {
                p[t]++;
            }
            for (int i = 0; i < n; i++) {
                g[i] = new int[p[i]];
            }
            for (int i = 0; i < from.length; i++) {
                g[from[i]][--p[from[i]]] = to[i];
                g[to[i]][--p[to[i]]] = from[i];
            }
            return g;
        }

    }

    static class EzIntArrayList implements EzIntList, EzIntStack {
        private static final int DEFAULT_CAPACITY = 10;
        private static final double ENLARGE_SCALE = 2.0;
        private static final int HASHCODE_INITIAL_VALUE = 0x811c9dc5;
        private static final int HASHCODE_MULTIPLIER = 0x01000193;
        private int[] array;
        private int size;

        public EzIntArrayList() {
            this(DEFAULT_CAPACITY);
        }

        public EzIntArrayList(int capacity) {
            if (capacity < 0) {
                throw new IllegalArgumentException("Capacity must be non-negative");
            }
            array = new int[capacity];
            size = 0;
        }

        public EzIntArrayList(EzIntCollection collection) {
            size = collection.size();
            array = new int[size];
            int i = 0;
            for (EzIntIterator iterator = collection.iterator(); iterator.hasNext(); ) {
                array[i++] = iterator.next();
            }
        }

        public EzIntArrayList(int[] srcArray) {
            size = srcArray.length;
            array = new int[size];
            System.arraycopy(srcArray, 0, array, 0, size);
        }

        public EzIntArrayList(Collection<Integer> javaCollection) {
            size = javaCollection.size();
            array = new int[size];
            int i = 0;
            for (int element : javaCollection) {
                array[i++] = element;
            }
        }

        public int size() {
            return size;
        }

        public EzIntIterator iterator() {
            return new EzIntArrayListIterator();
        }

        public boolean add(int element) {
            if (size == array.length) {
                enlarge();
            }
            array[size++] = element;
            return true;
        }

        public int get(int index) {
            if (index < 0 || index >= size) {
                throw new IndexOutOfBoundsException("Index " + index + " is out of range, size = " + size);
            }
            return array[index];
        }

        private void enlarge() {
            int newSize = Math.max(size + 1, (int) (size * ENLARGE_SCALE));
            int[] newArray = new int[newSize];
            System.arraycopy(array, 0, newArray, 0, size);
            array = newArray;
        }

        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            EzIntArrayList that = (EzIntArrayList) o;

            if (size != that.size) {
                return false;
            }
            for (int i = 0; i < size; i++) {
                if (array[i] != that.array[i]) {
                    return false;
                }
            }
            return true;
        }

        public int hashCode() {
            int hash = HASHCODE_INITIAL_VALUE;
            for (int i = 0; i < size; i++) {
                hash = (hash ^ PrimitiveHashCalculator.getHash(array[i])) * HASHCODE_MULTIPLIER;
            }
            return hash;
        }

        public String toString() {
            StringBuilder sb = new StringBuilder();
            sb.append('[');
            for (int i = 0; i < size; i++) {
                sb.append(array[i]);
                if (i < size - 1) {
                    sb.append(", ");
                }
            }
            sb.append(']');
            return sb.toString();
        }

        private class EzIntArrayListIterator implements EzIntIterator {
            private int curIndex = 0;

            public boolean hasNext() {
                return curIndex < size;
            }

            public int next() {
                if (curIndex == size) {
                    throw new NoSuchElementException("Iterator doesn't have more elements");
                }
                return array[curIndex++];
            }

        }

    }

    static final class PrimitiveHashCalculator {
        private PrimitiveHashCalculator() {
        }

        public static int getHash(int x) {
            return x;
        }

    }

    static interface EzIntIterator {
        boolean hasNext();

        int next();

    }

    static interface EzIntStack extends EzIntCollection {
        int size();

        EzIntIterator iterator();

        boolean equals(Object object);

        int hashCode();

        String toString();

    }
}

