#include <bits/stdc++.h>
using namespace std;
const int xx[4] = {0, 0, 1, -1};
const int yy[4] = {1, -1, 0, 0};
const int maxn = 200010;
const int maxd = 21;
const long long oo = 200000;
int first[maxn], second[maxn], dep[maxn], par[maxn], seq[maxn];
int n, q, ans, counter, fa[maxn][maxd], stk[maxn];
bool imp[maxn];
vector<int> tree[maxn], edge[maxn];
void build(int k, int f, int d) {
  first[k] = ++counter;
  fa[k][0] = f;
  dep[k] = d;
  for (int i = 1; i < maxd; i++) fa[k][i] = fa[fa[k][i - 1]][i - 1];
  for (int y : edge[k])
    if (y != f) build(y, k, d + 1);
  second[k] = counter;
}
bool cmp(int a, int b) { return first[a] < first[b]; }
int lca(int x, int y) {
  if (dep[x] < dep[y]) swap(x, y);
  for (int i = maxd - 1; i >= 0; i--)
    if (fa[x][i] && dep[fa[x][i]] >= dep[y]) x = fa[x][i];
  if (x == y) return x;
  for (int i = maxd - 1; i >= 0; i--)
    if (fa[x][i] != fa[y][i]) x = fa[x][i], y = fa[y][i];
  return fa[x][0];
}
bool dfs(int x, int has = 0) {
  for (int y : tree[x]) has += dfs(y);
  if (imp[x])
    return ans += has, 1;
  else if (has <= 1)
    return has;
  else
    return ans++, 0;
}
int main() {
  memset(fa, 0, sizeof fa);
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) edge[i].clear();
  for (int i = 1; i < n; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    edge[a].push_back(b);
    edge[b].push_back(a);
  }
  counter = 0;
  build(1, 0, 0);
  scanf("%d", &q);
  memset(imp, 0, sizeof imp);
  memset(stk, 0, sizeof stk);
  for (int i = 1, len; i <= q; i++) {
    scanf("%d", &len);
    for (int j = 1; j <= len; j++) {
      scanf("%d", &seq[j]);
      imp[seq[j]] = true;
    }
    sort(seq + 1, seq + 1 + len, cmp);
    int len2 = len;
    for (int j = 1; j < len; j++) seq[++len2] = lca(seq[j], seq[j + 1]);
    sort(seq + 1, seq + 1 + len2, cmp);
    len = unique(seq + 1, seq + 1 + len2) - seq - 1;
    int top = 0;
    ans = 0;
    for (int j = 1; j <= len; j++) {
      int x = seq[j];
      while (top > 0 && second[stk[top]] < first[x]) top--;
      tree[stk[top]].push_back(x);
      if (dep[x] - dep[stk[top]] == 1 && imp[x] && imp[stk[top]]) ans = -1;
      stk[++top] = x;
    }
    if (ans != -1) dfs(seq[1]);
    printf("%d\n", ans);
    for (int j = 1; j <= len; j++) {
      imp[seq[j]] = false;
      tree[seq[j]].clear();
    }
  }
  return 0;
}
