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.
#include <bits/stdc++.h>
using namespace std;
int Case, n, q, tot = 1, Head[100000 + 5], Dep[100000 + 5], Go[100000 + 5][19],
                T[100000 + 5], Ans[100000 + 5];
struct Edge {
  int next, node;
} h[100000 + 5 << 1];
inline void addedge(int u, int v) {
  h[++tot].next = Head[u], Head[u] = tot;
  h[tot].node = v;
}
void dfs(int z) {
  for (int i = Head[z]; i; i = h[i].next) {
    int d = h[i].node;
    if (d == Go[z][0]) continue;
    Go[d][0] = z;
    Dep[d] = Dep[z] + 1;
    for (int j = 1, x = z; Go[x][j - 1]; x = Go[x][j - 1], j++)
      Go[d][j] = Go[x][j - 1];
    dfs(d);
  }
}
int LCA(int u, int v) {
  if (Dep[u] < Dep[v]) swap(u, v);
  for (int t = Dep[u] - Dep[v]; t; t -= (t & -t))
    u = Go[u][__builtin_ffs(t) - 1];
  if (u == v) return u;
  for (int i = 19 - 1; Go[u][0] != Go[v][0]; i--)
    if (Go[u][i] != Go[v][i]) u = Go[u][i], v = Go[v][i];
  return Go[u][0];
}
void dfs(int z, int in) {
  for (int i = Head[z]; i; i = h[i].next) {
    if (i == (in ^ 1)) continue;
    int d = h[i].node;
    dfs(d, i);
    T[z] += T[d];
  }
  if (in) Ans[in >> 1] = T[z];
}
int main() {
  scanf("%d", &n);
  for (int i = 1, u, v; i < n; i++) {
    scanf("%d%d", &u, &v);
    addedge(u, v);
    addedge(v, u);
  }
  dfs(1);
  scanf("%d", &q);
  for (int u, v; q; q--) {
    scanf("%d%d", &u, &v);
    int lca = LCA(u, v);
    T[lca] -= 2, T[u]++, T[v]++;
  }
  dfs(1, 0);
  for (int i = 1; i < n; i++) printf("%d%c", Ans[i], i == n - 1 ? '\n' : ' ');
  return 0;
}
