#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &a) {
  T w = 1;
  a = 0;
  char ch = getchar();
  for (; ch < '0' || ch > '9'; ch = getchar())
    if (ch == '-') w = -1;
  for (; ch >= '0' && ch <= '9'; ch = getchar()) a = (a * 10) + (ch - '0');
  a *= w;
}
template <typename T>
inline void ckmax(T &a, T b) {
  a = a > b ? a : b;
}
template <typename T>
inline void ckmin(T &a, T b) {
  a = a < b ? a : b;
}
const int MAX = 1e5 + 10;
struct edge {
  int to, nex;
} e[MAX << 1], e1[MAX << 1];
int head[MAX], cnt;
int Head[MAX], cnt1;
inline void add(int u, int v) {
  e[++cnt].to = v;
  e[cnt].nex = head[u];
  head[u] = cnt;
}
inline void addedge(int u, int v) {
  e1[++cnt1].to = v;
  e1[cnt1].nex = Head[u];
  Head[u] = cnt1;
}
int que[MAX], tag[MAX], dfn[MAX], taa;
int sta[MAX], top;
int dep[MAX], dp[MAX][32];
void init(int u, int fa) {
  dep[u] = dep[fa] + 1;
  dp[u][0] = fa;
  dfn[u] = ++taa;
  for (int i = 1; (1 << i) <= dep[u]; ++i) dp[u][i] = dp[dp[u][i - 1]][i - 1];
  for (int i = head[u]; i; i = e[i].nex) {
    int v = e[i].to;
    if (v != fa) init(v, u);
  }
}
int LCA(int x, int y) {
  if (dep[x] < dep[y]) swap(x, y);
  for (int i = 20; i >= 0; --i) {
    if (dep[x] - (1 << i) >= dep[y]) x = dp[x][i];
  }
  if (x == y) return x;
  for (int i = 20; i >= 0; --i) {
    if (dp[x][i] != dp[y][i]) x = dp[x][i], y = dp[y][i];
  }
  return dp[x][0];
}
inline void insert(int x) {
  if (top == 1) {
    sta[++top] = x;
    return;
  }
  int lca = LCA(x, sta[top]);
  if (lca == sta[top]) {
    sta[++top] = x;
    return;
  }
  while (top > 1 && dfn[sta[top - 1]] >= dfn[lca]) {
    addedge(sta[top - 1], sta[top]);
    top--;
  }
  if (sta[top] != lca) {
    addedge(lca, sta[top]);
    sta[top] = lca;
  }
  sta[++top] = x;
}
bool cmp(int x, int y) { return dfn[x] < dfn[y]; }
int size[MAX], ans[MAX];
void dfs(int u) {
  size[u] = ans[u] = 0;
  for (int i = Head[u]; i; i = e1[i].nex) {
    int v = e1[i].to;
    dfs(v);
    size[u] += size[v];
    ans[u] += ans[v];
  }
  if (tag[u])
    ans[u] += size[u], size[u] = 1;
  else if (size[u] > 1)
    ans[u]++, size[u] = 0;
  Head[u] = 0;
}
int main() {
  int n;
  read(n);
  for (int i = 1; i < n; ++i) {
    int u, v;
    read(u);
    read(v);
    add(u, v);
    add(v, u);
  }
  int Q;
  read(Q);
  init(1, 0);
  while (Q--) {
    int k;
    read(k);
    for (int i = 1; i <= k; ++i) {
      read(que[i]);
      tag[que[i]] = 1;
    }
    top = cnt1 = 0;
    sta[++top] = 1;
    int flag = 0;
    for (int i = 1; i <= k; ++i)
      if (tag[que[i]] == tag[dp[que[i]][0]]) {
        flag = 1;
        break;
      }
    if (flag) {
      puts("-1");
      for (int i = 1; i <= k; ++i) tag[que[i]] = 0;
      continue;
    }
    sort(que + 1, que + k + 1, cmp);
    for (int i = 1; i <= k; ++i) {
      if (que[i] == 1) continue;
      insert(que[i]);
    }
    while (top) {
      addedge(sta[top - 1], sta[top]);
      top--;
    }
    dfs(1);
    printf("%d\n", ans[1]);
    for (int i = 1; i <= k; ++i) tag[que[i]] = 0;
  }
}
