#include <bits/stdc++.h>
using namespace std;
const int Inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3fll;
int n, q;
vector<int> nei[1 << 17];
int dfn[1 << 17], tmc;
int fa[18][1 << 17], lvl[1 << 17];
void dfs(int now, int lst) {
  fa[0][now] = lst;
  lvl[now] = lvl[lst] + 1;
  for (int i = 1; i <= (17); i++) fa[i][now] = fa[i - 1][fa[i - 1][now]];
  dfn[now] = ++tmc;
  for (int i = 0; i < (((int)(nei[now]).size())); i++) {
    int to = nei[now][i];
    if (to == lst) continue;
    dfs(to, now);
  }
}
int lca(int a, int b) {
  if (lvl[a] > lvl[b]) swap(a, b);
  int up = lvl[b] - lvl[a];
  for (int i = 0; i < (18); i++)
    if ((up >> i) & 1) b = fa[i][b];
  if (a == b) return a;
  for (int i = (17); ((-1) > 0 ? i <= (0) : i >= (0)); i += (-1))
    if (fa[i][a] != fa[i][b]) a = fa[i][a], b = fa[i][b];
  return fa[0][a];
}
bool inline DfnLess(int a, int b) { return dfn[a] < dfn[b]; }
vector<int> son[1 << 17];
int lgl[1 << 17];
vector<int> stk;
bool valid;
int gg[1 << 17];
int res;
void inline add(int a) {
  if (a == 1) return;
  int lc = lca(a, stk.back());
  if (lc != stk.back()) {
    while (dfn[lc] <= dfn[stk[stk.size() - 2]]) {
      son[stk[stk.size() - 2]].push_back(stk.back());
      stk.pop_back();
    }
    if (lc != stk.back()) {
      son[lc].push_back(stk.back());
      stk.pop_back();
      stk.push_back(lc);
    }
  }
  stk.push_back(a);
}
void inline check(int now) {
  int sm = 0;
  for (int i = 0; i < (((int)(son[now]).size())); i++) {
    int to = son[now][i];
    if (fa[0][to] == now && lgl[now] == q && lgl[to] == q) valid = 0;
    check(to);
    sm += gg[to];
  }
  if (lgl[now] == q) {
    res += sm;
    gg[now] = 1;
  } else {
    if (!sm)
      gg[now] = 0;
    else if (sm == 1)
      gg[now] = 1;
    else
      res++, gg[now] = 0;
  }
  son[now].clear();
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= (n - 1); i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    nei[a].push_back(b);
    nei[b].push_back(a);
  }
  dfs(1, 0);
  scanf("%d", &q);
  memset(lgl, -1, sizeof(lgl));
  while (q--) {
    vector<int> is;
    int len;
    scanf("%d", &len);
    is.resize(len);
    for (int i = 0; i < (len); i++) scanf("%d", &is[i]), lgl[is[i]] = q;
    sort((is).begin(), (is).end(), DfnLess);
    stk.clear();
    stk.push_back(0);
    stk.push_back(1);
    for (int i = 0; i < (len); i++) add(is[i]);
    while (stk.size() > 2) {
      son[stk[stk.size() - 2]].push_back(stk.back());
      stk.pop_back();
    }
    res = 0;
    valid = 1;
    check(1);
    if (!valid)
      puts("-1");
    else
      printf("%d\n", res);
  }
  return 0;
}
