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.lang.*;
import java.math.*;
import java.util.*;
import java.io.*;

public class Main {
class Node {
    int id;
    int x;
    public Node(int id,int x){
        this.id=id;
        this.x=x;
    }
}
    void solve() {
        int n=ni();
        g=new ArrayList[n+1];
        for(int i=1;i<=n;i++) g[i]=new ArrayList<>();
        for(int i=1;i<n;i++){
            int x=ni(),y=ni();
            g[x].add(new Node(i,y));
            g[y].add(new Node(i,x));
        }
        MAXL=20;
        parent=new int[n+1];
        level=new int[n+1];
        idx=new int[n+1];
        dfs(1,-1,0,-1);
        precompute(n);
        int q=ni();
        dp=new int[n+1];
        while(q-->0){
            int a=ni(),b=ni();
            int lca=lca(a,b);
            if(lca==a){
                dp[b]++; dp[a]--;
            }else if(lca==b){
                dp[a]++; dp[b]--;
            }else {
                dp[a]++; dp[b]++; dp[lca]-=2;
            }
        }
        dfs2(1,-1);
        for(int i=1;i<n;i++){
            pw.print(dp[idx[i]]+" ");
        }
        pw.println("");

    }
    int dp[];
    int idx[];
    ArrayList<Node> g[];
    static int P[][];
    static int MAXL; ///MAXL=log2(n);
    static int parent[];
    static int level[];
    void dfs2(int v,int pr){
        for(Node p : g[v]){
            if(p.x!=pr) {
                dfs2(p.x,v);
                dp[v]+=dp[p.x];
            }
        }
    }
    void dfs(int v,int pr,int l,int id){
        parent[v]=pr;
        level[v]=l;
        if(pr!=-1) idx[id]=v;
        for(Node p : g[v]){
            if(p.x!=pr) dfs(p.x,v,l+1,p.id);
        }
    }

    static void precompute(int n){
        P=new int[n+1][MAXL+1];
        for(int i=1;i<=n;i++){
            for(int j=0;(1<<j)<n;j++){
                P[i][j]=-1;
            }
        }
        for(int i=1;i<=n;i++)P[i][0]=parent[i];
        for(int j=1;(1<<j)<n;j++){
            for(int i=1;i<=n;i++){
                if(P[i][j-1]!=-1)P[i][j]=P[P[i][j-1]][j-1];
            }
        }

    }
    static int log2(int v){
        return (int)(Math.log10(v)/Math.log10(2));
    }
    static int lca(int u ,int v){
        if(level[u]<level[v]){
            int t=u;
            u=v;
            v=t;
        }
        int dist=level[u]-level[v];
        while(dist>0){
            int raise_by=log2(dist);
            u=P[u][raise_by];
            dist-=(1<<raise_by);
        }
        if(u==v) return u;
        for(int j=MAXL;j>=0;j--){
            if(P[u][j]!=-1 && P[u][j]!=P[v][j]){
                u=P[u][j];
                v=P[v][j];
            }
        }
        return parent[u];

    }
    long M = (long)1e9+7;
    InputStream is;
    PrintWriter pw;
    String INPUT = "";

    void run() throws Exception {
        is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
        pw = new PrintWriter(System.out);
        long s = System.currentTimeMillis();
        solve();
        pw.flush();
        if (!INPUT.isEmpty()) tr(System.currentTimeMillis() - s + "ms");

    }

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

    private byte[] inbuf = new byte[1024];
    public int lenbuf = 0, ptrbuf = 0;

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

    private boolean isSpaceChar(int c) {
        return !(c >= 33 && c <= 126);
    }

    private int skip() {
        int b;
        while ((b = readByte()) != -1 && isSpaceChar(b)) ;
        return b;
    }

    private double nd() {
        return Double.parseDouble(ns());
    }

    private char nc() {
        return (char) skip();
    }

    private String ns() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private char[] ns(int n) {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while (p < n && !(isSpaceChar(b))) {
            buf[p++] = (char) b;
            b = readByte();
        }
        return n == p ? buf : Arrays.copyOf(buf, p);
    }

    private char[][] nm(int n, int m) {
        char[][] map = new char[n][];
        for (int i = 0; i < n; i++) map[i] = ns(m);
        return map;
    }

    private int[] na(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = ni();
        return a;
    }

    private int ni() {
        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();
        }
    }

    private long nl() {
        long num = 0;
        int 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();
        }
    }

    private boolean oj = System.getProperty("ONLINE_JUDGE") != null;

    private void tr(Object... o) {
        if (INPUT.length() > 0) System.out.println(Arrays.deepToString(o));
    }

}