#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 10;
struct node {
  int v, next, en;
} e[2 * N];
long long cf[N];
long long ans[N];
int tot, a, b, n, u, v, k;
int head[N], deep[N];
int f[N][21];
void add_edge(int u, int v, int en) {
  e[tot].en = en;
  e[tot].v = v;
  e[tot].next = head[u];
  head[u] = tot++;
}
void dfs(int u, int fa) {
  deep[u] = deep[fa] + 1;
  f[u][0] = fa;
  for (int i = 1; (1 << i) <= deep[u]; i++) f[u][i] = f[f[u][i - 1]][i - 1];
  for (int i = head[u]; i != -1; i = e[i].next) {
    int v = e[i].v;
    if (v != fa) dfs(v, u);
  }
}
int LCA(int a, int b) {
  if (deep[a] > deep[b]) swap(a, b);
  for (int i = 20; i >= 0; i--)
    if (deep[f[b][i]] >= deep[a]) b = f[b][i];
  if (a == b) return a;
  for (int i = 20; i >= 0; i--)
    if (f[a][i] != f[b][i]) a = f[a][i], b = f[b][i];
  return f[a][0];
}
void make_cf(int u, int fa) {
  for (int i = head[u]; i != -1; i = e[i].next)
    if (e[i].v != fa) {
      int v = e[i].v;
      make_cf(v, u);
      cf[u] += cf[v];
      ans[e[i].en] += cf[v];
    }
}
void read(int &x) {
  char ch = getchar();
  x = 0;
  for (; ch < '0' || ch > '9'; ch = getchar())
    ;
  for (; ch >= '0' && ch <= '9'; ch = getchar())
    x = (x << 3) + (x << 1) + ch - '0';
}
int main() {
  memset(head, -1, sizeof(head));
  read(n);
  for (int i = 1; i < n; i++) {
    read(u);
    read(v);
    add_edge(u, v, i);
    add_edge(v, u, i);
  }
  dfs(1, 0);
  scanf("%d", &k);
  for (int i = 1; i <= k; i++) {
    scanf("%d%d", &u, &v);
    cf[u]++;
    cf[v]++;
    cf[LCA(u, v)] -= 2;
  }
  memset(ans, 0, sizeof(ans));
  make_cf(1, 0);
  for (int i = 1; i < n; i++) printf("%I64d ", ans[i]);
}
