#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long double PI = 3.1415926535897932384626;
const long double eps = 1e-9;
long long power(long long x, long long y) {
  long long ans = 1;
  x = x % mod;
  while (y > 0) {
    if (y & 1) ans = (ans * x) % mod;
    y = y >> 1;
    x = (x * x) % mod;
  }
  return ans;
}
vector<pair<long long, long long> > adj[100005];
long long ans[100005], n, cnt[100005], intime[100005], outtime[100005],
    up[100005][20], timer, lim, a, b, k;
long long dfs1(long long node, long long par) {
  long long tot = cnt[node];
  for (auto i : adj[node]) {
    if (i.first != par) {
      a = dfs1(i.first, node);
      tot += a;
      ans[i.second] += a;
    }
  }
  return tot;
}
void dfs2(long long node, long long par) {
  up[node][0] = par;
  intime[node] = ++timer;
  for (long long i = (long long)(1); i < (long long)(lim + 1); ++i)
    up[node][i] = up[up[node][i - 1]][i - 1];
  for (auto i : adj[node]) {
    if (i.first != par) dfs2(i.first, node);
  }
  outtime[node] = ++timer;
}
bool is_ancestor(long long a, long long b) {
  return (intime[a] <= intime[b] && outtime[a] >= outtime[b]);
}
long long lca(long long a, long long b) {
  if (is_ancestor(a, b)) return a;
  if (is_ancestor(b, a)) return b;
  for (long long i = (long long)(lim); i >= (long long)(0); --i) {
    if (!is_ancestor(up[a][i], b)) a = up[a][i];
  }
  return up[a][0];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (long long i = (long long)(0); i < (long long)(n - 1); ++i) {
    cin >> a >> b;
    adj[a].push_back(make_pair(b, i));
    adj[b].push_back(make_pair(a, i));
  }
  cin >> k;
  lim = ceil(log2(n));
  dfs2(1, 1);
  for (long long i = (long long)(0); i < (long long)(k); ++i) {
    cin >> a >> b;
    cnt[a]++;
    cnt[b]++;
    cnt[lca(a, b)] -= 2;
  }
  dfs1(1, 1);
  for (long long i = (long long)(0); i < (long long)(n - 1); ++i)
    cout << ans[i] << " ";
  return 0;
}
