#include <bits/stdc++.h>
using namespace std;
vector<int> mynodes;
vector<int> L[100000 + 1];
vector<int> aux[100000 + 1];
int is_special[100000 + 1];
int special[100000 + 1];
int parent[100000 + 1];
int block[100000 + 1];
int dp[100000 + 1];
int N, M, Q, K;
int euler[2 * 100000 + 1], euler_position[100000 + 1], height[100000 + 1];
int rmq[17 + 1][2 * 100000 + 1], two[2 * 100000 + 1];
int curr_height;
void DFS(int node, int father) {
  ++K;
  euler[K] = node;
  euler_position[node] = K;
  height[node] = ++curr_height;
  for (auto neighbour : L[node])
    if (neighbour != father) {
      DFS(neighbour, node);
      parent[neighbour] = node;
      euler[++K] = node;
    }
  --curr_height;
}
void Build() {
  int i, j;
  for (i = 2; i <= 2 * 100000; i++) two[i] = two[i / 2] + 1;
  for (i = 1; i <= K; i++) rmq[0][i] = euler[i];
  for (i = 1; (1 << i) <= K; i++)
    for (j = 1; j <= K - (1 << i) + 1; j++) {
      rmq[i][j] = rmq[i - 1][j];
      if (height[rmq[i - 1][j + (1 << i - 1)]] < height[rmq[i][j]])
        rmq[i][j] = rmq[i - 1][j + (1 << i - 1)];
    }
}
int getLCA(int x, int y) {
  x = euler_position[x];
  y = euler_position[y];
  if (x > y) swap(x, y);
  int k = two[y - x + 1];
  int LCA = rmq[k][x];
  if (height[LCA] > height[rmq[k][y + 1 - (1 << k)]])
    LCA = rmq[k][y + 1 - (1 << k)];
  return LCA;
}
bool cmp(const int A, const int B) {
  return (euler_position[A] < euler_position[B]);
}
bool upper(const int A, const int B) { return (height[A] < height[B]); }
int stk[100000 + 1];
int top;
void connect(int x, int y) {
  mynodes.push_back(x);
  mynodes.push_back(y);
  aux[x].push_back(y);
}
int getVirtual() {
  sort(special + 1, special + M + 1, cmp);
  stk[top = 1] = special[1];
  for (int i = 2; i <= M; i++) {
    int t = getLCA(stk[top], special[i]);
    while (height[stk[top - 1]] > height[t])
      connect(stk[top - 1], stk[top]), --top;
    if (t != stk[top]) connect(t, stk[top--]);
    if (t != stk[top]) stk[++top] = t;
    if (special[i] != stk[top]) stk[++top] = special[i];
  }
  while (top - 1) connect(stk[top - 1], stk[top]), --top;
  return stk[1];
}
void solveVirtual(int node) {
  for (auto neighbour : aux[node]) {
    solveVirtual(neighbour);
    dp[node] = dp[node] + dp[neighbour];
  }
  if (is_special[node] == 0) {
    int cnt = 0;
    for (auto neighbour : aux[node])
      if (block[neighbour] == 1) ++cnt;
    if (cnt > 1) {
      dp[node] = dp[node] + 1;
      block[node] = 0;
    } else if (cnt == 1) {
      block[node] = 1;
    } else {
      block[node] = 0;
    }
  } else {
    for (auto neighbour : aux[node])
      dp[node] = dp[node] + (block[neighbour] == 1);
    block[node] = 1;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  int i, x, y, root, res, ok;
  cin >> N;
  for (i = 1; i < N; i++) {
    cin >> x >> y;
    L[x].push_back(y);
    L[y].push_back(x);
  }
  DFS(1, 0);
  Build();
  cin >> Q;
  while (Q--) {
    cin >> M;
    for (i = 1; i <= M; i++) cin >> special[i];
    for (i = 1; i <= M; i++) is_special[special[i]] = 1;
    for (i = 1; i <= M; i++) mynodes.push_back(special[i]);
    ok = 1;
    for (i = 1; i <= M; i++)
      if (is_special[parent[special[i]]] == 1) ok = 0;
    if (ok == 1) {
      root = getVirtual();
      solveVirtual(root);
      res = dp[root];
    } else {
      res = -1;
    }
    cout << res << '\n';
    for (auto node : mynodes) aux[node].clear(), dp[node] = 0;
    for (i = 1; i <= M; i++) is_special[special[i]] = 0;
    mynodes.clear();
  }
  return 0;
}
