#include <bits/stdc++.h>
using namespace std;
long n, m;
list<long> a[200000 + 5];
list<long>::iterator p;
long d[200000 + 5], e[200000 + 5], g[200000 + 5];
long c[200000 + 5], v[200000 + 5], V[200000 + 5];
long x[200000 + 5], y[200000 + 5];
long L[200000 + 5][25];
void ct3(long i) {
  long j, k, t, nn;
  long hh[200000 + 5];
  long S[200000 + 5];
  d[0] = 0;
  for (i = (1); i <= (n); ++i) S[i] = 0;
  nn = 1;
  S[nn] = 1;
  while (nn > 0) {
    i = S[nn];
    bool ok = true;
    while (!a[i].empty()) {
      j = a[i].front();
      a[i].pop_front();
      if ((c[j] > c[i])) {
        e[V[j]] += g[j];
        S[++nn] = j;
        ok = false;
        break;
      }
    }
    if (ok) {
      e[V[v[i]]] += e[V[i]] - d[i];
      nn--;
    }
  }
}
long ct1(long i, long j) {
  long k, t;
  for (k = 1; 1 << k <= c[i]; ++k)
    ;
  --k;
  for (t = (k); t >= (0); --t)
    if (c[i] - (1 << t) >= c[j]) i = L[i][t];
  if (i == j) return i;
  for (t = (k); t >= (0); --t)
    if (L[i][t] != L[j][t]) {
      i = L[i][t];
      j = L[j][t];
    }
  return v[i];
}
long ct2(long i, long j) {
  long k, t;
  if (c[i] < j) return 0;
  for (k = 1; 1 << k <= c[i]; ++k)
    ;
  --k;
  for (t = (k); t >= (0); --t)
    if (c[i] - (1 << t) >= j) i = L[i][t];
  return i;
}
void kt1() {
  long i, j, k, t;
  queue<long> q;
  q.push(1);
  v[1] = -1;
  while (!q.empty()) {
    i = q.front();
    q.pop();
    for (p = (a[i].begin()); p != (a[i].end()); p++)
      if (v[(*p)] == 0) {
        k = *p;
        v[k] = i;
        c[k] = c[i] + 1;
        q.push(k);
      }
  }
  for (i = (1); i <= (n - 1); ++i) {
    if (v[x[i]] == y[i]) V[x[i]] = i;
    if (v[y[i]] == x[i]) V[y[i]] = i;
  }
}
void kt2() {
  long i, j, k, t;
  for (i = (1); i <= (n); ++i) L[i][0] = v[i];
  for (j = 1; 1 << j <= n; ++j)
    for (i = (1); i <= (n); ++i) L[i][j] = L[L[i][j - 1]][j - 1];
}
void ktao() {
  long i, j, k, t;
  scanf("%ld", &n);
  for (i = (1); i <= (n - 1); ++i) {
    scanf("%ld%ld", &x[i], &y[i]);
    a[x[i]].push_back(y[i]);
    a[y[i]].push_back(x[i]);
  }
  kt1();
  kt2();
}
void lam() {
  long i, j, k, t, ii, jj;
  scanf("%ld", &m);
  for (t = (1); t <= (m); ++t) {
    scanf("%ld%ld", &i, &j);
    if (i == j) continue;
    if (c[i] < c[j]) swap(i, j);
    k = ct1(i, j);
    ii = ct2(i, c[k] + 1);
    jj = ct2(j, c[k] + 1);
    d[ii]++;
    d[jj]++;
    g[i]++;
    if (k != j) g[j]++;
  }
  ct3(1);
}
void inkq() {
  long i, j, k, t;
  for (i = (1); i <= (n - 1); ++i) printf("%ld ", e[i]);
}
int main() {
  ktao();
  lam();
  inkq();
}
