#include <bits/stdc++.h>
using namespace std;
const int Maxn = 100010;
int n, m, tot, nex[Maxn << 1], head[Maxn], vet[Maxn << 1], cnt, dfn[Maxn],
    f[Maxn][20], a[Maxn], tag[Maxn], siz[Maxn], rt, ans, dep[Maxn], lg[Maxn];
vector<int> V[Maxn], P;
int read() {
  int ret = 0;
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  while (c >= '0' && c <= '9') {
    ret = ret * 10 + c - '0';
    c = getchar();
  }
  return ret;
}
void add(int u, int v) {
  nex[++tot] = head[u];
  head[u] = tot;
  vet[tot] = v;
}
void dfs1(int u, int fa) {
  dfn[u] = ++cnt;
  for (int i = head[u]; i; i = nex[i]) {
    int v = vet[i];
    if (v != fa) {
      f[v][0] = u;
      dep[v] = dep[u] + 1;
      dfs1(v, u);
    }
  }
}
int lca(int u, int v) {
  if (dep[u] < dep[v]) swap(u, v);
  while (dep[u] > dep[v]) u = f[u][lg[dep[u] - dep[v]]];
  if (u == v) return u;
  for (int i = lg[n]; i >= 0; i--)
    if (f[u][i] != f[v][i]) u = f[u][i], v = f[v][i];
  return f[u][0];
}
bool cmp(int x, int y) { return dfn[x] < dfn[y]; }
void build(int a[], int n) {
  sort(a + 1, a + n + 1, cmp);
  static int stk[Maxn];
  int top = 0;
  stk[++top] = a[1];
  for (int i = 2; i <= n; i++) {
    int v = a[i];
    P.push_back(v);
    int u = lca(stk[top], v);
    P.push_back(u);
    while (top && dep[stk[top]] > dep[u]) {
      top--;
      if (top && dep[stk[top]] > dep[u]) V[stk[top]].push_back(stk[top + 1]);
    }
    if (!top || stk[top] != a[i - 1]) V[u].push_back(stk[top + 1]);
    if (!top || stk[top] != u) stk[++top] = u;
    stk[++top] = v;
  }
  for (int i = 1; i < top; i++) V[stk[i]].push_back(stk[i + 1]);
  rt = stk[1];
}
void dfs2(int u) {
  if (tag[u])
    siz[u] = 1;
  else
    siz[u] = 0;
  int flag = 0;
  for (int i = 0; i < V[u].size(); i++) {
    int v = V[u][i];
    dfs2(v);
    if (tag[u] && siz[v]) ans++;
    if (!tag[u] && siz[v]) {
      if (flag == 1) siz[u] = 0, ans++, flag++;
      if (!flag) siz[u] = siz[v], flag++;
    }
  }
}
int main() {
  n = read();
  for (int i = 1; i < n; i++) {
    int u = read(), v = read();
    add(u, v);
    add(v, u);
  }
  dep[1] = 1;
  dfs1(1, 0);
  for (int i = 2; i <= n; i++) lg[i] = lg[i >> 1] + 1;
  for (int j = 1; j <= lg[n]; j++)
    for (int i = 1; i <= n; i++) f[i][j] = f[f[i][j - 1]][j - 1];
  m = read();
  for (int i = 1; i <= m; i++) {
    int k = read();
    for (int j = 1; j <= k; j++) a[j] = read(), tag[a[j]] = 1;
    bool flag = true;
    for (int j = 1; j <= k; j++)
      if (tag[f[a[j]][0]]) {
        flag = false;
        puts("-1");
        break;
      }
    if (!flag) {
      for (int j = 1; j <= k; j++) tag[a[j]] = 0;
      continue;
    }
    build(a, k);
    ans = 0;
    dfs2(rt);
    printf("%d\n", ans);
    for (int j = 1; j <= k; j++) tag[a[j]] = 0;
    for (int j = 0; j < P.size(); j++) V[P[j]].clear();
    P.clear();
  }
  return 0;
}
