#include <bits/stdc++.h>
using namespace std;
namespace yspm {
inline long long read() {
  long long res = 0, f = 1;
  char k;
  while (!isdigit(k = getchar()))
    if (k == '-') f = -1;
  while (isdigit(k)) res = res * 10 + k - '0', k = getchar();
  return res * f;
}
const long long N = 1e5 + 10;
long long head[N], cnt, dep[N], ans[N], fa[N][30], lg[N], p[N], n, q;
struct node {
  long long nxt, to;
} e[N << 1];
inline void add(long long u, long long v) {
  e[++cnt].nxt = head[u];
  e[cnt].to = v;
  return head[u] = cnt, void();
}
inline void dfs(long long now, long long fat) {
  fa[now][0] = fat;
  dep[now] = dep[fat] + 1;
  for (long long i = 1; (1 << i) <= dep[now]; ++i)
    fa[now][i] = fa[fa[now][i - 1]][i - 1];
  for (long long i = head[now]; i; i = e[i].nxt) {
    long long t = e[i].to;
    if (t == fa[now][0]) continue;
    dfs(e[i].to, now);
  }
  return;
}
inline long long lca(long long x, long long y) {
  if (dep[x] < dep[y]) swap(x, y);
  while (dep[x] > dep[y]) x = fa[x][lg[dep[x] - dep[y]] - 1];
  if (x == y) return y;
  for (long long k = lg[dep[x]] - 1; k >= 0; --k)
    if (fa[x][k] != fa[y][k]) x = fa[x][k], y = fa[y][k];
  return fa[x][0];
}
inline void work(long long x) {
  for (long long i = head[x]; i; i = e[i].nxt) {
    long long t = e[i].to;
    if (t == fa[x][0]) continue;
    work(t);
    p[x] += p[t];
  }
  return;
}
signed main() {
  n = read();
  for (long long i = 1, u, v; i < n; ++i)
    u = read(), v = read(), add(u, v), add(v, u);
  for (long long i = 1; i < N; ++i) lg[i] = lg[i - 1] + ((1 << lg[i - 1]) == i);
  dfs(1, 0);
  q = read();
  while (q--) {
    long long x = read(), y = read();
    p[x]++;
    p[y]++;
    p[lca(x, y)] -= 2;
  }
  work(1);
  for (long long x = 1; x <= n; ++x) {
    for (long long i = head[x]; i; i = e[i].nxt) {
      long long u = x, v = e[i].to;
      if (dep[u] > dep[v]) swap(u, v);
      ans[(i + 1) >> 1] = p[v];
    }
  }
  for (long long i = 1; i < n; ++i) cout << ans[i] << " ";
  puts("");
  return 0;
}
}  // namespace yspm
signed main() { return yspm::main(); }
