#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 50;
const int S = 18;
vector<pair<int, int> > Edges[N];
int JumperPoint[N][S + 2];
int VertexDepth[N];
int EdgePrefixSum[N];
int Edge_FoolsTravelingThrough[N];
void WczytajDane(int &n, int &m) {}
void LiczWartosci(int v) {
  for (int i = 0; i < (int)Edges[v].size(); i++) {
    if (Edges[v][i].first == JumperPoint[v][0]) continue;
    JumperPoint[Edges[v][i].first][0] = v;
    VertexDepth[Edges[v][i].first] = VertexDepth[v] + 1;
    LiczWartosci(Edges[v][i].first);
  }
}
void LiczJumperPoint(int n) {
  for (int j = 1; j < S; j++) {
    for (int i = 1; i <= n; i++)
      JumperPoint[i][j] = JumperPoint[JumperPoint[i][j - 1]][j - 1];
  }
}
int LCA(int v, int u) {
  if (VertexDepth[v] < VertexDepth[u]) swap(v, u);
  for (int i = S - 1; i >= 0; i--) {
    if (VertexDepth[JumperPoint[v][i]] >= VertexDepth[u]) v = JumperPoint[v][i];
  }
  if (v == u) return v;
  for (int i = S - 1; i >= 0; i--) {
    if (JumperPoint[v][i] != JumperPoint[u][i]) {
      v = JumperPoint[v][i];
      u = JumperPoint[u][i];
    }
  }
  return JumperPoint[v][0];
}
void DodajSciezki(int m) {
  int a, b;
  for (int i = 1; i <= m; i++) {
    cin >> a >> b;
    EdgePrefixSum[a]++;
    EdgePrefixSum[b]++;
    EdgePrefixSum[LCA(a, b)] -= 2;
  }
}
int LiczSumy(int v) {
  int ind = 0;
  for (int i = 0; i < (int)Edges[v].size(); i++) {
    if (Edges[v][i].first == JumperPoint[v][0]) {
      ind = Edges[v][i].second;
      continue;
    }
    EdgePrefixSum[v] += LiczSumy(Edges[v][i].first);
  }
  Edge_FoolsTravelingThrough[ind] = EdgePrefixSum[v];
  return EdgePrefixSum[v];
}
int main() {
  int number_ef_cities, number_of_travels;
  int a, b;
  cin >> number_ef_cities;
  for (int i = 1; i < number_ef_cities; i++) {
    cin >> a >> b;
    Edges[a].push_back(make_pair(b, i));
    Edges[b].push_back(make_pair(a, i));
  }
  cin >> number_of_travels;
  WczytajDane(number_ef_cities, number_of_travels);
  LiczWartosci(1);
  JumperPoint[1][0] = 1;
  LiczJumperPoint(number_ef_cities);
  JumperPoint[1][0] = 0;
  DodajSciezki(number_of_travels);
  LiczSumy(1);
  for (int i = 1; i < number_ef_cities; i++)
    cout << Edge_FoolsTravelingThrough[i] << " ";
  cout << "\n";
  return 0;
}
