#include <bits/stdc++.h>
const int INF = 1e8;
using namespace std;
const int N = 1e5 + 5;
int n, m, sgn, dfn[N], dad[N], lg[N], f[N], a[N], top, st[N];
bool g[N], b[N];
vector<int> V[N], E[N];
namespace LCA {
int dep[N], f[N][20];
void dfs(int fa, int u) {
  dfn[u] = ++sgn;
  dad[u] = fa;
  dep[u] = !fa ? 0 : dep[fa] + 1, f[u][0] = fa;
  for (int i = 1; i <= lg[dep[u]]; i++) {
    f[u][i] = f[f[u][i - 1]][i - 1];
  }
  for (int v : V[u]) {
    if (v != fa) {
      dfs(u, v);
    }
  }
}
inline int lca(int u, int v) {
  if (dep[u] > dep[v]) swap(u, v);
  while (dep[u] < dep[v]) v = f[v][lg[dep[v] - dep[u]]];
  if (u == v) return u;
  for (int i = lg[dep[u]]; i >= 0; i--) {
    if (f[u][i] != f[v][i]) u = f[u][i], v = f[v][i];
  }
  return f[u][0];
}
}  // namespace LCA
bool cmp(int i, int j) { return dfn[i] < dfn[j]; }
void dgs(int u) {
  f[u] = 0, g[u] = 0;
  if (b[u]) g[u] = 1;
  int sum = 0;
  for (int v : E[u]) {
    dgs(v);
    if (b[u]) {
      f[u] += g[v] + f[v];
    } else {
      sum += g[v];
      f[u] += f[v];
    }
  }
  if (!b[u]) {
    if (sum > 1)
      f[u]++;
    else if (sum == 1)
      g[u] = 1;
  }
}
void clear(int u) {
  for (int v : E[u]) {
    clear(v);
  }
  E[u].clear();
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    V[u].push_back(v), V[v].push_back(u);
  }
  lg[0] = -1;
  for (int i = 1; i <= n; i++) lg[i] = lg[i >> 1] + 1;
  LCA::dfs(0, 1);
  int T;
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &m);
    for (int i = 1; i <= m; i++) {
      scanf("%d", &a[i]);
      b[a[i]] = 1;
    }
    bool fl = 0;
    for (int i = 1; i <= m; i++) {
      if (b[dad[a[i]]]) {
        for (int j = 1; j <= m; j++) b[a[j]] = 0;
        puts("-1");
        fl = 1;
        break;
      }
    }
    if (fl) continue;
    sort(a + 1, a + m + 1, cmp);
    top = 1, st[1] = a[1];
    for (int i = 2; i <= m; i++) {
      int l = LCA::lca(a[i], st[top]);
      if (st[top] == l) {
        st[++top] = a[i];
      } else {
        while (top && dfn[l] <= dfn[st[top - 1]]) {
          if (top > 1) {
            E[st[top - 1]].push_back(st[top]);
          }
          top--;
        }
        if (dfn[l] < dfn[st[top]]) {
          E[l].push_back(st[top]);
          top--;
        }
        if (!top || st[top] != l) st[++top] = l;
        st[++top] = a[i];
      }
    }
    for (; top > 1; top--) {
      E[st[top - 1]].push_back(st[top]);
    }
    dgs(st[1]);
    printf("%d\n", f[st[1]]);
    for (int i = 1; i <= m; i++) b[a[i]] = 0;
    clear(st[1]);
  }
  return 0;
}
