#include <bits/stdc++.h>
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
long long exp(long long x, long long y) {
  x %= 1000000007;
  long long res = 1;
  while (y) {
    if (y & 1) res = res * x % 1000000007;
    x = x * x % 1000000007;
    y >>= 1;
  }
  return res;
}
long long fact(long long n) {
  long long res = 1;
  for (long long i = 2; i <= n; i = i + 1) (res *= i) %= 1000000007;
  return res;
}
bool isprime(long long n) {
  if (n <= 1) return 0;
  for (long long i = 2; i * i <= n; ++i)
    if (n % i == 0) return 0;
  return 1;
}
const int N = 1e5 + 5;
vector<array<int, 2>> g[N];
int up[N][20], timer, tin[N], tout[N], c[N][2];
void pre(int s, int par = 0) {
  up[s][0] = par;
  tin[s] = ++timer;
  for (int i = 1; i < 20; ++i) {
    up[s][i] = up[up[s][i - 1]][i - 1];
  }
  for (auto to : g[s]) {
    if (to[0] != par) pre(to[0], s);
  }
  tout[s] = ++timer;
}
bool valid(int a, int b) { return (tin[a] <= tin[b] && tout[a] >= tout[b]); }
int get(int a, int b) {
  if (valid(a, b)) return a;
  if (valid(b, a)) return b;
  for (int i = 19; i >= 0; --i) {
    if (up[a][i] && !valid(up[a][i], b)) {
      a = up[a][i];
    }
  }
  return up[a][0];
}
void dfs(int s, int par = 0) {
  for (auto to : g[s]) {
    if (to[0] != par) {
      dfs(to[0], s);
      c[to[1]][0] += c[to[0]][1];
      c[s][1] += c[to[0]][1];
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n;
  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    cin >> a >> b;
    g[a].push_back({b, i});
    g[b].push_back({a, i});
  }
  cin >> k;
  pre(1);
  for (int i = 0; i < k; ++i) {
    int a, b;
    cin >> a >> b;
    ++c[a][1];
    ++c[b][1];
    c[get(a, b)][1] -= 2;
  }
  dfs(1);
  for (int i = 0; i < n - 1; ++i) cout << c[i][0] << " ";
  return 0;
}
