#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int n, q, k[N];
int first[N], nxt[N << 1], first2[N], nxt2[N << 1], tot = 0, tot2 = 0;
int cnt = 0, dfn[N], pre[N], top[N], size[N], son[N], depth[N];
int stck[N], tp;
int f[N], g[N], tag[N], ok;
struct Edge {
  int u, v;
} edge[N << 1], edge2[N << 1];
bool cmp1(const int a, const int b) { return dfn[a] < dfn[b]; }
int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 1) + (x << 3) + c - '0';
    c = getchar();
  }
  return f * x;
}
void Add(int u, int v) {
  tot++;
  nxt[tot] = first[u];
  first[u] = tot;
  edge[tot] = (Edge){u, v};
  return;
}
void DFS1(int u, int fa) {
  size[u] = 1;
  for (int j = first[u]; j != -1; j = nxt[j]) {
    int v = edge[j].v;
    if (v == fa) continue;
    pre[v] = u;
    depth[v] = depth[u] + 1;
    DFS1(v, u);
    size[u] += size[v];
    if ((!son[u]) || (size[son[u]] < size[v])) son[u] = v;
  }
  return;
}
void DFS2(int u, int t) {
  top[u] = t;
  dfn[u] = ++cnt;
  if (!son[u]) return;
  DFS2(son[u], t);
  for (int j = first[u]; j != -1; j = nxt[j]) {
    int v = edge[j].v;
    if (v == pre[u] || v == son[u]) continue;
    DFS2(v, v);
  }
  return;
}
int LCA(int u, int v) {
  while (top[u] != top[v]) {
    if (depth[top[u]] < depth[top[v]]) swap(u, v);
    u = pre[top[u]];
  }
  if (dfn[u] > dfn[v]) swap(u, v);
  return u;
}
void Add2(int u, int v) {
  tot2++;
  nxt2[tot2] = first2[u];
  first2[u] = tot2;
  edge2[tot2] = (Edge){u, v};
  return;
}
void Addedge(int u, int v) {
  Add2(u, v);
  Add2(v, u);
  return;
}
void Build(int u) {
  if (tp == 1) {
    stck[++tp] = u;
    return;
  }
  int lca = LCA(u, stck[tp]);
  if (lca == stck[tp]) {
    stck[++tp] = u;
    return;
  }
  while (tp > 1 && dfn[stck[tp - 1]] >= dfn[lca])
    Addedge(stck[tp], stck[tp - 1]), tp--;
  if (lca != stck[tp]) Addedge(lca, stck[tp]), stck[tp] = lca;
  stck[++tp] = u;
  return;
}
void DP(int u, int fa) {
  int sum = 0, tmpsum = 0;
  for (int j = first2[u]; j != -1; j = nxt2[j]) {
    int v = edge2[j].v;
    if (v == fa) continue;
    DP(v, u);
    tmpsum += f[v];
    sum += g[v];
  }
  if (tag[u]) {
    g[u] = 1;
    f[u] = sum + tmpsum;
  } else {
    if (sum > 1)
      g[u] = 0, f[u] = 1 + tmpsum;
    else
      g[u] = sum, f[u] = tmpsum;
  }
  return;
}
void Print(int u, int fa) {
  int line[100], r = 0;
  printf("%d : ", u);
  for (int j = first2[u]; j != -1; j = nxt2[j]) {
    int v = edge2[j].v;
    if (v == fa) continue;
    printf("%d ", v);
    line[++r] = v;
  }
  printf("\n");
  for (int i = 1; i <= r; i++) Print(line[i], u);
  return;
}
void Init(int u, int fa) {
  for (int j = first2[u]; j != -1; j = nxt2[j]) {
    int v = edge2[j].v;
    if (v == fa) continue;
    Init(v, u);
  }
  f[u] = g[u] = 0;
  first2[u] = -1;
  return;
}
int main() {
  memset(first2, -1, sizeof(first2));
  memset(first, -1, sizeof(first));
  n = read();
  for (int i = 1; i < n; i++) {
    int u = read(), v = read();
    Add(u, v), Add(v, u);
  }
  DFS1(1, 0);
  DFS2(1, 1);
  q = read();
  while (q--) {
    tot2 = 0;
    ok = 1;
    k[0] = read();
    for (int i = 1; i <= k[0]; i++) k[i] = read(), tag[k[i]] = 1;
    for (int i = 1; i <= k[0]; i++)
      if (tag[pre[k[i]]]) ok = 0;
    sort(k + 1, k + k[0] + 1, cmp1);
    if (!ok) {
      for (int i = 1; i <= k[0]; i++) tag[k[i]] = 0;
      printf("-1\n");
      continue;
    }
    stck[tp = 1] = 1;
    for (int i = 1; i <= k[0]; i++)
      if (k[i] != 1) Build(k[i]);
    while (tp > 1) Addedge(stck[tp], stck[tp - 1]), tp--;
    DP(1, 0);
    printf("%d\n", f[1]);
    for (int i = 1; i <= k[0]; i++) tag[k[i]] = 0;
    Init(1, 0);
  }
  return 0;
}
