output_description: If Takahashi's submission gets an AC, print `Yes`; otherwise, print `No`.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N M
attempt: # make_tree(graph, root) -> dist, parent
  
  # LCA: Last Common Ancestor (最近共通祖先)
  # lca(u, v, dist, parent)
  
  # Inclusion-exclusion principle: 包除原理
  # http://satanic0258.hatenablog.com/entry/2016/04/10/104524
  # A∨B∨C = ￢(￢A￢B∨￢C)
  
  N = int(input())
  AB = [list(map(int, input().split())) for _ in range(N - 1)]
  M = int(input())
  UV = [list(map(int, input().split())) for _ in range(M)]
  
  MOD = 10**9 + 7
  
  graph = [[] for _ in range(N + 1)]
  for a, b in AB:
      graph[a].append(b)
      graph[b].append(a)
  
  
  def make_tree(graph, root):
      INF = 10**15
      dist = [INF] * len(graph)
      parent = [-1] * len(graph)
      stack = [root]
      dist[root] = 0
      parent[root] = root
      while stack:
          s = stack.pop()
          for g in graph[s]:
              if dist[g] > dist[s] + 1:
                  dist[g] = dist[s] + 1
                  parent[g] = s
                  stack.append(g)
      return dist, parent
  
  
  def lca(u, v, dist, parent):
      distu, distv = dist[u], dist[v]
      if distu > distv:
          for _ in range(distu - distv):
              u = parent[u]
      if distv > distu:
          for _ in range(distv - distu):
              v = parent[v]
      while u != v:
          u, v = parent[u], parent[v]
      return u
  
  
  dist, parent = make_tree(graph, 1)
  # print(parent)
  
  for i, (u, v) in enumerate(UV):
      UV[i].append(lca(u, v, dist, parent))
  
  cnt = [0] * (N + 1)
  for u, v, l in UV:
      tmp = [1] * (N + 1)
      uu, vv = u, v
      while uu != l:
          tmp[uu] = 0
          uu = parent[uu]
      while vv != l:
          tmp[vv] = 0
          vv = parent[vv]
      for i in range(2, N + 1):
          cnt[i] += tmp[i]
  print(cnt)
  
  cnt_tmp = 0
  for i in range(2, N + 1):
      if cnt[i]:
          cnt_tmp += 1
  print((pow(2, N - 1, MOD) - pow(2, cnt_tmp, MOD)) % MOD)
  
problem_description: Statement
  
  Takahashi is participating in a programming contest, AXC001. He has just
  submitted his code to Problem A.  
  The problem has N test cases, all of which must be passed to get an AC
  verdict.  
  Takahashi's submission has passed M cases out of the N test cases.  
  Determine whether Takahashi's submission gets an AC.
samples: [{"input": "3 3", "output": "Yes\n    \n\nAll three test cases have been passed, so his submission gets an AC.\n\n* * *"}, {"input": "3 2", "output": "No\n    \n\nOnly two out of the three test cases have been passed, so his submission does\nnot get an AC.\n\n* * *"}, {"input": "1 1", "output": "Yes"}]