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.
//package cf121;

import java.io.*;
import java.util.*;
import java.util.stream.Collectors;

public class C {
    static boolean CONSTRUCTIVE = false;
    static long MOD = (long) 1e9 + 7;
    static long BIG = (long) 2e9;

    static int n;
    static Node[] tree;
    static Node[][] lift;
    static int[] vals;
    static LinkedHashMap<Edge, Integer> edgeWeights;

    static class Edge {
        int a, b;

        public Edge(int a, int b) {
            this.a = a;
            this.b = b;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            Edge edge = (Edge) o;
            return (a == edge.a && b == edge.b)
                    || (b == edge.a && a == edge.b);
        }

        @Override
        public int hashCode() {
            return Objects.hashCode(a+b);
        }
    }

    public static void solve(Reader in, PrintWriter out) {
        n = in.nextInt();
        edgeWeights = new LinkedHashMap<>();
        lift = new Node[1+n][1+(int)Math.sqrt(n)];
        tree = construct(n, in); // tree[0] == null, tree[1] is the root
        vals = new int[n+1];

        int k = in.nextInt();
        for (int i = 0; i < k; i++) {
            int a = in.nextInt();
            int b = in.nextInt();

            Node anc = tree[a].lca(tree[b]);
            vals[a]++;
            vals[b]++;
            vals[anc.id] -= 2;
        }
        tree[1].fillWeights();

        for (int v : edgeWeights.values()) {
            out.print(v + " ");
        }
        out.println();
    }

    public static void main(String[] args) throws IOException {
        Reader in = null;
        PrintWriter out = null;
        for (String arg : args) {
            if (arg.startsWith("input")) {
                in = new Reader(arg);
            } else if (arg.startsWith("output")) {
                out = new PrintWriter(new FileWriter(arg));
            }
        }
        if (in == null) in = new Reader();
        if (out == null) out = new PrintWriter(new OutputStreamWriter(System.out));

//        int tests = in.nextInt();
//        for (int t = 0; t < tests; t++) {
            solve(in, out);
//        }

        out.flush();
    }

    static class Node {
        int id;
        Node parent;
        SortedSet<Node> children;
        int depth;

        public Node(int id) {
            this.id = id;
            this.children = new TreeSet<>(Comparator.comparingInt(v->v.id));
        }

        void construct(Node parent) {
            this.parent = parent;
            if (parent == null) {
                depth = 0;
            } else {
                lift[id][0] = parent;
                int i = 1;
                Node last = parent;
                while (last != null) {
                    last = lift[last.id][i-1];
                    lift[id][i++] = last;
                }

                depth = 1 + parent.depth;
                children.remove(parent);
            }
            for (Node child : children) child.construct(this);
        }

        Node lca(Node that) {
            if (id == that.id) return this;

            if (depth < that.depth) {
                return that.lca(this);
            } else if (depth > that.depth) {
                Node last = this;
                for (int i = 0; i < lift[id].length; i++) {
                    if (lift[id][i] != null && lift[id][i].depth >= that.depth) {
                        last = lift[id][i];
                    } else break;
                }
                return last.lca(that);
            } else {
                Node anc = this;
                Node thatAnc = that;
                for (int i = 0; i < lift[id].length; i++) {
                    if (lift[id][i] == null || lift[that.id][i] == null
                        || lift[id][i].id == lift[that.id][i].id) {
                        break;
                    }
                    anc = lift[id][i];
                    thatAnc = lift[that.id][i];
                }
                if (parent == null || that.parent == null || parent.id == that.parent.id) return parent;
                return anc.lca(thatAnc);
            }
        }

        // fill weight of the edge from parent -> this
        int fillWeights() {
            int totalWeight = 0;
            for (Node child : children) {
                totalWeight += child.fillWeights();
            }
            if (parent != null) {
                totalWeight += vals[id];
                edgeWeights.put(new Edge(parent.id, id), totalWeight);
            }
            return totalWeight;
        }

        @Override
        public String toString() {
            return ""+id;
        }
    }

    // constructs a tree with n nodes, rooted at 1
    static Node[] construct(int n, Reader in) {
        Node[] arr = new Node[n+1];
        for (int i = 1; i <= n; i++) {
            arr[i] = new Node(i);
        }

        for (int i = 0; i < n - 1; i++) {
            int a = in.nextInt();
            int b = in.nextInt();
            edgeWeights.put(new Edge(a,b), 0);
            arr[a].children.add(arr[b]);
            arr[b].children.add(arr[a]);
        }
        arr[1].construct(null);
        return arr;
    }

    static class Tester {
        public static void main(String[] args) throws IOException {
            Validator validator = new Validator();

            System.out.println("SAMPLE TESTS:");
            File currentDir = new File(".");
            long before;
            long after;
            for (File inputFile : Arrays.stream(currentDir.listFiles())
                    .sorted(Comparator.comparing(File::getName))
                    .collect(Collectors.toList())) {
                if (!inputFile.getName().matches("input[0-9]")) continue;
                int number = Integer.parseInt(inputFile.getName().substring(5));
                System.out.printf("Test %d: \n", number);

                before = System.nanoTime();
                String outputFileName = "output" + inputFile.getName().substring(5);
                C.main(new String[]{inputFile.getName(), outputFileName});
                after = System.nanoTime();

                File outputFile = new File("output" + number);
                if (!outputFile.exists()) {
                    throw new IllegalStateException("Missing output file " + outputFile);
                }

                // TODO if verifier is implemented, remove this
                if (CONSTRUCTIVE) {
                    System.out.println("INPUT:");
                    printFile(inputFile);
                    System.out.printf("\nOUTPUT: (%d milliseconds)\n", (after - before) / 1000000L);
                    printFile(outputFile);
                    continue;
                }

                if (validator.validate(inputFile, outputFile)) {
                    System.out.printf("OK (%d milliseconds)\n", (after - before) / 1000000L);
                } else {
                    System.out.println("FAILED");
                    System.out.println("\nInput: ");
                    printFile(inputFile);
                    System.out.println("\nIncorrect Output: ");
                    printFile(outputFile);
                    return;
                }
            }
            System.out.println("\n-----------------\n");

            File sightTestInput = new File("input-sight");
            if (sightTestInput.exists()) {
                System.out.println("Running sight test... Input:");
                printFile(sightTestInput);
                before = System.nanoTime();
                System.out.println("\nOutput: ");
                C.main(new String[]{"input-sight"});
                after = System.nanoTime();
                System.out.printf("(%d milliseconds)\n", (after - before) / 1000000L);
                System.out.println("\n-----------------\n");
            }

            File bigTestInput = new File("input-big");
            if (bigTestInput.exists()) {
                System.out.println("Running big test...");
                before = System.nanoTime();
                C.main(new String[] {"input-big"});
                after = System.nanoTime();
                System.out.printf("(%d milliseconds)\n", (after - before) / 1000000L);
            }
        }

        static void printFile(File file) throws FileNotFoundException {
            BufferedReader reader = new BufferedReader(new FileReader(file));
            reader.lines().forEach(System.out::println);
        }
    }

    static class Validator {
        boolean validate(File inputFile, File outputFile) throws IOException {
            int number = Integer.parseInt(inputFile.getName().substring(5));
            File expectedOutputFile = new File("expected-output" + number);
            if (CONSTRUCTIVE || !expectedOutputFile.exists()) {
                return validateManual(inputFile, outputFile);
            }
            return areSame(outputFile, expectedOutputFile);
        }

        private boolean validateManual(File inputFile, File outputFile) throws IOException {
            // OPTION 1: validate against naive solution
//            Naive.main(new String[] {inputFile.getName()});


            // OPTION 2: Validate output against input (typically for constructive problems)
            Reader inputReader = new Reader(inputFile.getName());
            Reader outputReader = new Reader(outputFile.getName());

            // TODO implement manual validation

            throw new IllegalStateException("Missing expected output file");
        }

        private boolean areSame(File file1, File file2) throws IOException {
            BufferedReader reader1 = new BufferedReader(new FileReader(file1));
            BufferedReader reader2 = new BufferedReader(new FileReader(file2));

            String line1;
            while ((line1 = reader1.readLine()) != null) {
                String line2 = reader2.readLine();
                if (line2 == null) line2 = ""; // ok if one has an extra newline
                if (!line1.trim().equals(line2.trim())) {
                    return false;
                }
            }
            String line2;
            while ((line2 = reader2.readLine()) != null) {
                if (!line2.trim().isEmpty()) {
                    return false;
                }
            }
            return true;
        }

    }

    static class Naive {
        public static void solveNaive(Reader in, PrintWriter out) {

        }

        public static void main(String[] args) throws IOException {
            Reader in = null;
            PrintWriter out = null;
            for (String arg : args) {
                if (arg.startsWith("input")) {
                    in = new Reader(arg);
                } else if (arg.startsWith("output")) {
                    out = new PrintWriter(new FileWriter(arg));
                }
            }
            if (in == null) in = new Reader();
            if (out == null) out = new PrintWriter(new OutputStreamWriter(System.out));

            int tests = in.nextInt();
            for (int t = 0; t < tests; t++) {
                solve(in, out);
            }

            out.flush();
            out.close();
        }
    }

    static long pair(int x, int y) {
        return x * BIG + y;
    }

    static int x(long pair) {
        return (int) (pair / BIG);
    }

    static int y(long pair) {
        return (int) (pair % BIG);
    }

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

        public Reader() {
            reader = new BufferedReader(new InputStreamReader(System.in), 32768);
            tokenizer = null;
        }

        public Reader(String fileName) throws FileNotFoundException {
            reader = new BufferedReader(new FileReader(fileName));
        }

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

        public long nextLong() {
            return Long.parseLong(next());
        }

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

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