#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const int INF = 0x3f3f3f3f;
int n;
vector<int> g[100000 + 20];
int fa[100000 + 20][18], depth[100000 + 20], dfn[100000 + 20], cnt;
void dfs(int now = 1, int pre = 0, int deep = 1) {
  dfn[now] = ++cnt;
  depth[now] = deep;
  fa[now][0] = pre;
  for (int i = 1; i <= 17; ++i) fa[now][i] = fa[fa[now][i - 1]][i - 1];
  for (int it : g[now]) {
    if (it != pre) dfs(it, now, deep + 1);
  }
}
int jump(int node, int dis) {
  for (int i = 17; i >= 0; --i) {
    if ((dis >> i) & 1) node = fa[node][i];
  }
  return node;
}
int lca(int u, int v) {
  if (depth[u] > depth[v]) swap(u, v);
  v = jump(v, depth[v] - depth[u]);
  if (u == v) return u;
  for (int i = 17; i >= 0; --i) {
    if (fa[u][i] != fa[v][i]) {
      u = fa[u][i];
      v = fa[v][i];
    }
  }
  return fa[v][0];
}
vector<int> vt[100000 + 20];
vector<int> key_nodes, used;
int imp[100000 + 20];
bool cmp(int A, int B) { return dfn[A] < dfn[B]; }
map<pair<int, int>, bool> exi;
pair<int, int> run(int now) {
  for (auto it : vt[now]) {
    if (imp[now] && imp[it] && exi.find(make_pair(now, it)) != exi.end()) {
      return make_pair(-1, -1);
    }
  }
  int cnt = 0;
  int rest = 0;
  for (auto it : vt[now]) {
    pair<int, int> tmp = run(it);
    rest += tmp.first;
    cnt += tmp.second;
    if (tmp.first == -1) return make_pair(-1, -1);
  }
  if (imp[now]) {
    rest += cnt;
    cnt = 1;
  } else {
    if (cnt > 1) {
      cnt = 0;
      rest++;
    }
  }
  return make_pair(rest, cnt);
}
int calc() {
  sort(key_nodes.begin(), key_nodes.end(), cmp);
  stack<int> s;
  s.push(1);
  used.push_back(1);
  for (auto it : key_nodes) {
    if (it == 1) continue;
    int las = s.top();
    int llc = lca(las, it);
    if (llc == las) {
      s.push(it);
    } else {
      while (depth[s.top()] > depth[llc]) {
        int z = s.top();
        s.pop();
        if (depth[s.top()] > depth[llc])
          vt[s.top()].push_back(z);
        else
          vt[llc].push_back(z);
      }
      if (s.top() != llc) {
        used.push_back(llc);
        s.push(llc);
      }
      s.push(it);
    }
    used.push_back(it);
  }
  while (!s.empty()) {
    int z = s.top();
    s.pop();
    if (!s.empty()) vt[s.top()].push_back(z);
  }
  int rest = run(1).first;
  return rest;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 2; i <= n; ++i) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
    exi[make_pair(u, v)] = exi[make_pair(v, u)] = 1;
  }
  dfs();
  int q;
  cin >> q;
  while (q--) {
    used.clear();
    int k;
    cin >> k;
    key_nodes.clear();
    for (int i = 1; i <= k; ++i) {
      int key;
      cin >> key;
      imp[key] = 1;
      key_nodes.push_back(key);
    }
    cout << calc() << endl;
    for (auto it : used) {
      imp[it] = 0;
      vt[it].clear();
    }
  }
  return 0;
}
