#include <bits/stdc++.h>
using namespace std;
struct node {
  int to, next;
} edge[2 * 110000];
int cnt, pre[110000];
void add_edge(int u, int v) {
  edge[cnt].to = v;
  edge[cnt].next = pre[u];
  pre[u] = cnt++;
}
int deep[110000];
int order[110000];
int indx = 0;
struct Lca_Online {
  int _n;
  int dp[110000][20];
  void _dfs(int s, int fa, int dd) {
    deep[s] = dd;
    order[s] = ++indx;
    for (int p = pre[s]; p != -1; p = edge[p].next) {
      int v = edge[p].to;
      if (v == fa) continue;
      _dfs(v, s, dd + 1);
      dp[v][0] = s;
    }
  }
  void _init() {
    for (int j = 1; (1 << j) <= _n; j++) {
      for (int i = 1; i <= _n; i++) {
        if (dp[i][j - 1] != -1) dp[i][j] = dp[dp[i][j - 1]][j - 1];
      }
    }
  }
  void lca_init(int n) {
    _n = n;
    memset(dp, -1, sizeof(dp));
    indx = 0;
    _dfs(1, -1, 0);
    _init();
  }
  int lca_query(int a, int b) {
    if (deep[a] > deep[b]) swap(a, b);
    for (int i = 20 - 1; deep[b] > deep[a]; i--)
      if (deep[b] - (1 << i) >= deep[a]) b = dp[b][i];
    if (a == b) return a;
    for (int i = 20 - 1; i >= 0; i--) {
      if (dp[a][i] != dp[b][i]) a = dp[a][i], b = dp[b][i];
    }
    return dp[a][0];
  }
} lca;
int stk[110000], top;
int mark[110000];
vector<int> tree[110000];
vector<int> treew[110000];
void tree_add(int u, int v, int w) {
  tree[u].push_back(v);
  tree[v].push_back(u);
  treew[u].push_back(w);
  treew[v].push_back(w);
}
int build_vtree(int vp[], int vn) {
  if (vn == 0) return -1;
  top = 0;
  int i = 0;
  if (vp[0] == 1) {
    stk[top++] = vp[0];
    tree[vp[0]].clear();
    treew[vp[0]].clear();
    mark[vp[0]] = 1;
    i++;
  } else {
    stk[top++] = 1;
    tree[1].clear();
    treew[1].clear();
  }
  for (; i < vn; i++) {
    int v = vp[i];
    int plca = lca.lca_query(stk[top - 1], v);
    if (plca == stk[top - 1])
      ;
    else {
      int pos = top - 1;
      while (pos >= 0 && deep[stk[pos]] > deep[plca]) pos--;
      pos++;
      for (int j = pos; j < top - 1; j++) {
        tree_add(stk[j], stk[j + 1], deep[stk[j + 1]] - deep[stk[j]]);
      }
      int prepos = stk[pos];
      if (pos == 0) {
        tree[plca].clear(), treew[plca].clear(), stk[0] = plca, top = 1;
        mark[plca] = 0;
      } else if (stk[pos - 1] != plca) {
        tree[plca].clear(), treew[plca].clear(), stk[pos] = plca, top = pos + 1;
        mark[plca] = 0;
      } else
        top = pos;
      tree_add(prepos, plca, deep[prepos] - deep[plca]);
    }
    tree[v].clear();
    treew[v].clear();
    stk[top++] = v;
    mark[v] = 1;
  }
  for (int i = 0; i < top - 1; i++) {
    tree_add(stk[i], stk[i + 1], deep[stk[i + 1]] - deep[stk[i]]);
  }
  return vp[0];
}
struct vnode {
  int order, id;
} vg[110000];
int vcmp(vnode t1, vnode t2) { return t1.order < t2.order; }
int vsort(int vp[], int vn) {
  for (int i = 0; i < vn; i++) vg[i].id = vp[i], vg[i].order = order[vp[i]];
  sort(vg, vg + vn, vcmp);
  for (int i = 0; i < vn; i++) vp[i] = vg[i].id;
  return build_vtree(vp, vn);
}
int flag = 0, ans = 0;
int dfs(int now, int pre = -1) {
  int sum = 0, flg = 0;
  if (pre != -1 && mark[now] == 0 && mark[pre] == 1) sum++;
  for (int i = 0; i < tree[now].size(); i++) {
    if (tree[now][i] != pre) {
      if (mark[now] == 1 && mark[tree[now][i]] == 1 && treew[now][i] == 1)
        flag = 1;
      else if (mark[now] == 1 && mark[tree[now][i]] == 1 && treew[now][i] > 1)
        ans++;
      if (mark[now] == 0) {
        int t = dfs(tree[now][i], now);
        flg |= t;
        sum += t;
      } else
        dfs(tree[now][i], now);
    }
  }
  if (mark[now] == 0 && sum >= 2) ans++, flg = 0;
  if (mark[now] == 1) return 1;
  if (flg && mark[now] == 0) return 1;
  return 0;
}
void dfs0(int now, int pre = -1) {
  mark[now] = 0;
  for (int i = 0; i < tree[now].size(); i++) {
    if (tree[now][i] != pre) {
      dfs0(tree[now][i], now);
    }
  }
  tree[now].clear();
  treew[now].clear();
}
int num[110000];
int main() {
  int n;
  scanf("%d", &n);
  memset(pre, -1, sizeof(pre));
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    add_edge(x, y);
    add_edge(y, x);
  }
  lca.lca_init(n);
  int q;
  scanf("%d", &q);
  while (q--) {
    int k;
    scanf("%d", &k);
    for (int i = 0; i < k; i++) scanf("%d", num + i);
    flag = 0;
    ans = 0;
    vsort(num, k);
    dfs(1);
    dfs0(1);
    if (flag) ans = -1;
    printf("%d\n", ans);
  }
  return 0;
}
