191_C. Fools and Roads
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.
```python
import os
import sys
from io import BytesIO, IOBase
from types import GeneratorType
from collections import defaultdict
BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
sys.setrecursionlimit(2*10**5)


def bootstrap(f, stack=[]):
    def wrappedfunc(*args, **kwargs):
        if stack:
            return f(*args, **kwargs)
        else:
            to = f(*args, **kwargs)
            while True:
                if type(to) is GeneratorType:
                    stack.append(to)
                    to = next(to)
                else:
                    stack.pop()
                    if not stack:
                        break
                    to = stack[-1].send(to)
            return to
    return wrappedfunc






MA=10**5+1
level=20
tree=[[] for i in range(MA)]
depth=[0 for i in range(MA)]
parent=[[0 for i in range(level)] for j in range(MA)]


@bootstrap
def dfs(cur,prev):
    depth[cur] = depth[prev] + 1
    parent[cur][0] = prev
    res.append(cur)
    for i in range(len(tree[cur])):
        if (tree[cur][i] != prev):
            yield dfs(tree[cur][i], cur)

    res.append(-cur)
    yield

def precomputeSparseMatrix(n):
    for i in range(1,level):
        for node in range(1,n+1):
            if (parent[node][i-1] != -1):
                parent[node][i] =parent[parent[node][i-1]][i-1]


def lca(u,v):
    if (depth[v] < depth[u]):
        u,v=v,u

    diff = depth[v] - depth[u]


    for i in range(level):
        if ((diff >> i) & 1):
            v = parent[v][i]


    if (u == v):
        return u

    i=level-1
    while(i>=0):

        if (parent[u][i] != parent[v][i]):
            u = parent[u][i]
            v = parent[v][i]

        i+=-1

    return parent[u][0]



def add(a,b):
    tree[a].append(b)
    tree[b].append(a)

def res(s,t,f):
    p=lca(t,f)
    q=lca(s,f)
    if p==q:
        r=depth[lca(s,t)]-depth[p]
        return min(depth[p] + depth[f] - 2 * depth[p] + 1+r, depth[q] + depth[f] - 2 * depth[q] + 1+r)


    return min(depth[p]+depth[f]-2*depth[p]+1,depth[q]+depth[f]-2*depth[q]+1)







ord=[]
n=int(input())
for j in range(n-1):
    u,v=map(int,input().split())
    ord.append([u, v])
    tree[u].append(v)
    tree[v].append(u)

res=[]
dfs(1,0)
precomputeSparseMatrix(n)
d=dict()
l=len(res)
req=[0]*(l)
for j in range(l):
    d[res[j]]=j

k=int(input())
c=[0]*(n+1)
for j in range(k):
    u,v=map(int,input().split())

    lc=lca(u,v)
    c[lc]+=1
    if u==lc:
        indu=d[u]
        indv=d[v]
        req[indu]+=1
        req[indv+1]+=-1
    elif v==lc:
        indu = d[u]
        indv = d[v]
        req[indv] += 1
        req[indu + 1] += -1

    else:
        indl=d[lc]
        indu = d[u]
        indv = d[v]
        req[indl]+=1
        req[indu+1]+=-1
        req[indl+1]+=1
        req[indv+1]+=-1


for j in range(1,l):
    req[j]+=req[j-1]


ans=[0]*(n+1)
for j in range(1,n+1):
    ans[j]=req[d[j]]-req[d[-j]]

for j in ord:
    l=lca(j[0],j[1])
    if l==j[0]:
        print(ans[j[1]]-c[j[1]],end=" ")
    else:
        print(ans[j[0]] - c[j[0]], end=" ")



































```