#include <bits/stdc++.h>
using namespace std;
vector<int> c, re, dis, c2;
vector<vector<pair<int, int> > > adj;
int n, a, b, k, fa[100005][20];
void ini() {
  c.assign(n, 0);
  re.assign(n, 0);
  dis.assign(n, -1);
  adj.assign(n, vector<pair<int, int> >(0));
}
int lca(int x, int y) {
  for (int i = 0; i < 20; i++)
    if ((dis[x] - dis[y]) & (1 << i)) x = fa[x][i];
  if (x == y) return x;
  for (int i = 19; i >= 0; i--)
    if (fa[x][i] != fa[y][i]) x = fa[x][i], y = fa[y][i];
  return fa[x][0];
}
int dfs(int u) {
  int sum = 0;
  for (int j = 0; j < adj[u].size(); j++) {
    int v = adj[u][j].first;
    if (dis[v] == dis[u] + 1) {
      int te = dfs(v) + c[v];
      re[adj[u][j].second] += te;
      sum += te;
    }
  }
  return sum;
}
int main() {
  cin >> n;
  ini();
  for (int i = 0; i < n - 1; i++) {
    cin >> a >> b;
    adj[a - 1].push_back(pair<int, int>(b - 1, i));
    adj[b - 1].push_back(pair<int, int>(a - 1, i));
  }
  queue<int> q;
  q.push(0);
  dis[0] = 0;
  fa[0][0] = 0;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = 1; i < 20; i++) fa[u][i] = fa[fa[u][i - 1]][i - 1];
    for (int j = 0; j < adj[u].size(); j++) {
      int v = adj[u][j].first;
      if (dis[v] == -1) {
        dis[v] = dis[u] + 1;
        q.push(v);
        fa[v][0] = u;
      }
    }
  }
  cin >> k;
  for (int i = 0; i < k; i++) {
    cin >> a >> b;
    c[a - 1]++;
    c[b - 1]++;
    if (dis[a - 1] >= dis[b - 1])
      c[lca(a - 1, b - 1)] -= 2;
    else
      c[lca(b - 1, a - 1)] -= 2;
  }
  int te = dfs(0);
  cout << re[0];
  for (int i = 1; i < n - 1; i++) cout << " " << re[i];
  cout << endl;
  return 0;
}
