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.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.PrintWriter;
import java.util.ArrayList;
public class C191 
{
    static class SegmentTree
    {
        int n;
        long tree[];
        long start[];
        long end[];
        long lazy[];
        public SegmentTree(int n)
        {
            this.n=n;
            tree=new long[4*n+1];
            start=new long[4*n+1];
            end=new long[4*n+1];
            lazy=new long[4*n+1];
            initialize(1,0,n-1);
        }
        void initialize(int node,int s,int e)
        {
            start[node]=s;
            end[node]=e;
            if(s==e)
            {
                return;
            }
            
            int mid=(s+e)/2;
            initialize(2*node,s,mid);
            initialize(2*node+1,mid+1,e);
        }
        void lazyPropagation(int node)
        {
            
            lazy[2*node]+=lazy[node];
            lazy[2*node+1]+=lazy[node];
            lazy[node]=0;
        }
        void update(int node)
        {
            long leftValue=tree[2*node]+(end[2*node]-start[2*node]+1)*lazy[2*node];
            long rightValue=tree[2*node+1]+(end[2*node+1]-start[2*node+1]+1)*lazy[2*node+1];
            tree[node]=leftValue+rightValue;
        }
        void incrementRange(int l,int r,long value)
        {
            incrementRange(1,l,r,value);
        }   
        void incrementRange(int node,int l,int r,long value)
        {
            if(start[node]>r||end[node]<l)
                return;
            if(start[node]>=l&&end[node]<=r)
            {
                lazy[node]+=value;
                return;
            }
            lazyPropagation(node);
            incrementRange(2*node,l,r,value);
            incrementRange(2*node+1,l,r,value);
            update(node);
            
        }
        long query(int l,int r)
        {
            return query(1,l,r);
        }
        long query(int node,int l,int r)
        {
            if(start[node]>r||end[node]<l)
                return 0;
            if(start[node]>=l&&end[node]<=r)
            {
                return tree[node]+(end[node]-start[node]+1)*lazy[node];
            }
            lazyPropagation(node);
            long leftValue=query(2*node,l,r);
            long rightValue=query(2*node+1,l,r);
            update(node);
            return leftValue+rightValue;
        }
    }
    
    static ArrayList<Integer> g[];//graph
    //static ArrayList<Integer> w[];//edge weights
    static int p[];//parent
    static int h[];//height
    static int ch[];//chain head
    static int pos[];//position in segment tree
    static int sc[];//special child
    //static int val[];//value of edge connecting this node to its parent
    static int time;
    static ArrayList<int[]> edge;//list of all edges
    static boolean dn=false;
    static void clear(int n)//intitialize each test case
    {
        if(!dn)
        {
            gen();//initialize first case
            dn=true;
            return;
        }
        edge.clear();
        time=-1;
        for(int i=0;i<=n;i++)
        {
            g[i].clear();
      //      w[i].clear();
            p[i]=h[i]=ch[i]=sc[i]=pos[i]=0;
        }
        
    }
    static void gen()//initialize first case
    {
        edge=new ArrayList<>();
        g=new ArrayList[100001];
        //w=new ArrayList[100001];
        for(int i=0;i<=100000;i++)
        {
            g[i]=new ArrayList<>();
            //w[i]=new ArrayList<>();
        }
        p=new int[100001];
        h=new int[100001];
        ch=new int[100001];
        sc=new int[100001];
        pos=new int[100001];
        //val=new int[100001];
        time=-1;
    }
    static int dfs1(int n,int ht)//dfs to calculate height and sppecial child n is node ,ht is height
    {
        h[n]=ht;
        int count=1,maxcount=0;
        for(int i=0;i<g[n].size();i++)
        {
            int nn=g[n].get(i);
            if(nn==p[n])
                continue;
            p[nn]=n;
           // val[nn]=w[n].get(i);
            int uu=dfs1(nn,ht+1);
            if(uu>maxcount)
            {
                maxcount=uu;
                sc[n]=nn;
            }
            count+=uu;
        }
        return count;
    }
    static void dfs2(int par,int n)//dfs to perform hld par is parent,n is node
    {
        pos[n]=++time;
        if(sc[par]==n)
        {
            ch[n]=ch[par];
        }
        else
        {
            ch[n]=n;
        }
        if(sc[n]!=0)
            dfs2(n,sc[n]);
        for(int nn:g[n])
        {
            if(nn==p[n]||nn==sc[n])
                continue;
            dfs2(n,nn);
        }
    }
        
    static void solve() throws IOException
    {
        Scanner in=new Scanner(System.in);
        PrintWriter out=new PrintWriter(System.out);
        {
            int n=in.nextInt();
            clear(n);
            for(int i=1;i<n;i++)
            {
                int u=in.nextInt(),v=in.nextInt();
                g[u].add(v);
                g[v].add(u);
                //w[u].add(c);
                //w[v].add(c);
                edge.add(new int[]{u,v});
            }
            dfs1(1,1);
            dfs2(0,1);
            SegmentTree st=new SegmentTree(n);
            int m=in.nextInt();
            while(m--!=0)
            {
                
                {
                    int u=in.nextInt();
                    int v=in.nextInt();
                    int ans=0;
                    while(u!=v)
                    {
                        if(ch[u]==ch[v])//u and v lie in same chain
                        {
                            if(pos[u]>pos[v])//Why?
                            {
                                int y=u;u=v;v=y;//swap u,v
                            }
                            st.incrementRange(pos[u]+1, pos[v],1);
                            break;
                        }
                        else//u and v lie in different chains
                        {
                            if(h[ch[u]]<h[ch[v]])//why?
                            {
                                int x=u;u=v;v=x;//swap u,v;
                            }
                            st.incrementRange(pos[ch[u]], pos[u],1);
                            u=p[ch[u]];
                        }
                    }
                    
                }
                
            }
            for(int e[]:edge)
            {
                int u=(h[e[0]]<h[e[1]])?e[1]:e[0];
                out.print(st.query(pos[u], pos[u])+" ");
            }
            out.println();
        }
        
        out.close();
    }
    /*------------------------------------done-------------------------------------------*/
    
    
    static class Scanner
    {
        BufferedReader br;
        StringTokenizer tk=new StringTokenizer("");
        public Scanner(InputStream is) 
        {
            br=new BufferedReader(new InputStreamReader(is));
        }
        public int nextInt() throws IOException
        {
            if(tk.hasMoreTokens())
                return Integer.parseInt(tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return nextInt();
        }
        public long nextLong() throws IOException
        {
            if(tk.hasMoreTokens())
                return Long.parseLong(tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return nextLong();
        }
        public String next() throws IOException
        {
            if(tk.hasMoreTokens())
                return (tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return next();
        }
        public String nextLine() throws IOException
        {
            tk=new StringTokenizer("");
            return br.readLine();
        }
        public double nextDouble() throws IOException
        {
            if(tk.hasMoreTokens())
                return Double.parseDouble(tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return nextDouble();
        }
        public char nextChar() throws IOException
        {
            if(tk.hasMoreTokens())
                return (tk.nextToken().charAt(0));
            tk=new StringTokenizer(br.readLine());
            return nextChar();
        }
        public int[] nextIntArray(int n) throws IOException
        {
            int a[]=new int[n];
            for(int i=0;i<n;i++)
                a[i]=nextInt();
            return a;
        }
        public long[] nextLongArray(int n) throws IOException
        {
            long a[]=new long[n];
            for(int i=0;i<n;i++)
                a[i]=nextLong();
            return a;
        }
        public int[] nextIntArrayOneBased(int n) throws IOException
        {
            int a[]=new int[n+1];
            for(int i=1;i<=n;i++)
                a[i]=nextInt();
            return a;
        }
        public long[] nextLongArrayOneBased(int n) throws IOException
        {
            long a[]=new long[n+1];
            for(int i=1;i<=n;i++)
                a[i]=nextLong();
            return a;
        }
    
    
    }
    
    public static void main(String args[]) throws IOException
    {
        new Thread(null, new Runnable() {
            public void run() {
                try
                {
                    solve();
                }
                catch(Exception e)
                {
                    e.printStackTrace();
                }
            }
        }, "1", 1 << 26).start();
        
    }
}
