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.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.StringTokenizer;

/*
Fools and Roads
192 E
http://codeforces.com/problemset/problem/192/E
LCA
 */

/*
5
1 2
1 3
2 4
2 5
2
1 4
3 5

5
3 4
4 5
1 4
2 4
3
2 3
1 3
3 5
 */
public class CF_192E implements Runnable {

  public static void main(String[] args) {
    new Thread(null, new CF_192E(), "", 1 << 26).start();
//    new CF_192E().run();
  }
  public void run() {
    try {
      BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
      PrintWriter out = new PrintWriter(System.out);
      
      int n = Integer.parseInt(in.readLine());
      HLD g = new HLD(n);
      int[][] edges = new int[2][n];
      for(int i = 0; i < n-1; ++i) {
        StringTokenizer tok = new StringTokenizer(in.readLine());
        int v1 = Integer.parseInt(tok.nextToken())-1;
        int v2 = Integer.parseInt(tok.nextToken())-1;
        
        edges[0][i] = v1;
        edges[1][i] = v2;
        
        g.add(v1, v2);
      }
//      g.goItr(0);
      g.go(0);
      
      int k = Integer.parseInt(in.readLine());
      for(int i = 0; i < k; ++i) {
        StringTokenizer tok = new StringTokenizer(in.readLine());
        int v1 = Integer.parseInt(tok.nextToken())-1;
        int v2 = Integer.parseInt(tok.nextToken())-1;
        
        g.update(v1, v2, 1);
      }
      
      for(int i = 0; i < n - 1; ++i) {
        out.print(g.count(edges[0][i], edges[1][i]) +" ");
      }
      out.println();
      
      out.close();
      in.close();
    } catch (Throwable e) {
      e.printStackTrace();
      System.exit(1);
    }
  }

  
  //# Heavy-Light Decomposition
  //Decomposes a tree into heavy and light paths for logn path queries 
  //in the tree. Can be used to find the lowest common ancestor as well
  //as to increment counts on nodes along the path between two nodes.
  //Uses: Create the HLD, add all the edges, run go(root). //$
  static class HLD {
   ArrayList<Integer>[] adj;
   int n;
   // hN - nodes sorted by heavy index, stores actual index.
   // hI - the heavy index in the tree.
   // hP - the heavyIndex of the node that starts the heavy path to this node.
   // lP - the heavyIndex of the node that is the parent of the heavyPath node.
   int[] hN, hI, hP, lP, size, par;
   SuperBIT bit;
   HLD(int N) {
     adj = new ArrayList[n = N];
     bit = new SuperBIT(n);
     for(int i = 0; i < n; ++i)
       adj[i] = new ArrayList<Integer>();
     hN = new int[n]; hI = new int[n];
     hP = new int[n]; lP = new int[n];
     size = new int[n];
     par = new int[n];
     Arrays.fill(size, 1);
     Arrays.fill(par, -1);
   }
   void add(int v1, int v2) {
     adj[v1].add(v2); adj[v2].add(v1);
   }
   
   static boolean getDepth;
   static int ind = 0;
   void go(int start) {
     getDepth = true; dfs(start);
     getDepth = false; dfs(start);
   }
   void dfs(int v) {
     if(!getDepth) {
       int p = par[v];
       hI[v] = ind; hN[ind] = v;
       if(p != -1 && hI[p] == ind-1) {
         hP[v] = hP[p];
         lP[v] = lP[p];
       } else {
         hP[v] = ind;
         if(p != -1) lP[v] = hI[p];
         else lP[v] = ind;
       }
       ++ind;
     }
     int max = 0;
     for(int c = 0; c < adj[v].size(); ++c) {
       int u = adj[v].get(c);
       if(u == par[v]) continue;
       par[u] = v; dfs(u);
       if(getDepth) { 
         size[v] += size[u];
         if(size[max] < size[u]) max = c;
       }
     }
     if(max > 0)
       Collections.swap(adj[v], 0, max);
   }
   
   //#
   void goItr(int start) {
     dfsItr(start, true);
     dfsItr(start, false);
   }
   void dfsItr(int start, boolean getDepth) {
     int[] children = new int[n];
     ArrayDeque<Integer> st = new ArrayDeque<Integer>(n);
     st.add(start); 
     int ind = 0;
     boolean cont = false;
     int[][] largestChild = null;
     if(getDepth)
       largestChild = new int[2][n];
     while(!st.isEmpty()) {
       int node = st.pop();
       int p = par[node];
       int child = children[node];
       int before = 0;
       if(child < 0) {
         child = -child -1;
         before = 1;
       }
       if(!getDepth && child == 0 && before == 0) {
         hI[node] = ind;
         hN[ind] = node;
         if(cont) {
           hP[hN[ind]] = hP[hN[ind-1]];
           lP[hN[ind]] = lP[hN[ind-1]];
         } else {
           cont = true;
           hP[hN[ind]] = ind;
           if(p != -1) {
             lP[hN[ind]] = hI[p];
           } else {
             lP[hN[ind]] = ind;
           }
         }
         ++ind;
       }
       if(before == 0)
         if(child < adj[node].size() && p == adj[node].get(child))
           ++child;
       if(child < adj[node].size()) {
         int next = adj[node].get(child);
         if(before == 0) {
           children[node] = -child-1;
           st.push(node);
           par[next] = node;
           st.push(next);
         } else {
           children[node] = 1+child;
           st.push(node);
           if(getDepth) { 
             size[node] += size[next];
             if(largestChild[1][node] < size[next]) {
               largestChild[1][node] = size[next];
               largestChild[0][node] = child;
             }
           } else {
             cont = false;
           }
         }
       } else if(!getDepth) {
         cont = false;
       }
     }
     if(getDepth) 
       for(int i = 0; i < n; ++i) 
         if(largestChild[0][i] > 0)
           Collections.swap(adj[i], 0, largestChild[0][i]);
   }
   //$
   // Lowest common ancestor
   int lca(int v1, int v2) {
     int n1 = hI[v1], n2 = hI[v2];
     while(true) {
       if(hP[hN[n1]] == hP[hN[n2]])
         if(n1 < n2) return hN[n1];
         else return hN[n2];
       else if(n1 > n2) n1 = lP[hN[n1]];
       else n2 = lP[hN[n2]];
     }
   }
   // Count node values along the path from v1 to v2.
   long count(int v1, int v2) {
     int n1 = hI[v1], n2 = hI[v2];
     long ans = 0;
     while(true) {
       if(hP[hN[n1]] == hP[hN[n2]]) {
         if(n1 > n2) {
           ans += bit.query(n2+1, n1);
         } else if(n1 < n2) {
           ans += bit.query(n1+1, n2);
         }
         break;
       } else if(n1 > n2) {
         ans += bit.query(hP[hN[n1]], n1);
         n1 = lP[hN[n1]];
       } else {
         ans += bit.query(hP[hN[n2]], n2);
         n2 = lP[hN[n2]];
       }
     }
     return ans;
   }
   // Update every node along the path from v1 to v2 by the delta
   void update(int v1, int v2, long delta) {
     int n1 = hI[v1], n2 = hI[v2];
     while(true) {
       if(hP[hN[n1]] == hP[hN[n2]]) {
         if(n1 > n2) {
           bit.update(n2+1, n1, delta);
         } else if(n1 < n2) {
           bit.update(n1+1, n2, delta);
         }
         break;
       } else if(n1 > n2) {
         bit.update(hP[hN[n1]], n1, delta);
         n1 = lP[hN[n1]];
       } else {
         bit.update(hP[hN[n2]], n2, delta);
         n2 = lP[hN[n2]];
       }
     }
   }
  }
  //#
  static class SuperBIT {
   long[] dataMul, dataAdd;
   SuperBIT(int n) {
     dataMul = new long[n];
     dataAdd = new long[n];
   }
   void update(int left, int right, long val) {
     internalUpdate(left, val, -val * (left-1));
     internalUpdate(right, -val, val * right);
   }
   void internalUpdate(int at, long mul, long add) {
     while (at < dataMul.length) {
       dataMul[at] += mul;
       dataAdd[at] += add;
       at |= (at + 1);
     }
   }
   long query(int at) {
     long mul = 0;
     long add = 0;
     int start = at;
     while(at >= 0) {
       mul += dataMul[at];
       add += dataAdd[at];
       at = (at & (at + 1)) -1;
     }
     return mul * start + add;
   }
   long query(int left, int right) {
     if (left > right) {
       int temp = left;
       left = right;
       right = temp;
     }
     return query(right) - (left > 0 ? query(left-1) : 0);
   }
  }
  //$

}
