#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int he[N], ver[N * 2], nex[N * 2], tot;
inline void add(int&, int&);
int book[N];
int id[N], top[N], siz[N], fa[N], dep[N], son[N], ct;
void dfs1(int), dfs2(int, int);
int lca(int, int);
int st[N], arr[N];
int ans;
struct cmp {
  bool operator()(const int& a, const int& b) { return id[a] < id[b]; }
};
void dp(int);
int c[N];
int main() {
  int n;
  scanf("%d", &n);
  int u, v;
  tot = 1;
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &u, &v);
    add(u, v), add(v, u);
  }
  dfs1(1), dfs2(1, 1);
  int m;
  scanf("%d", &m);
  while (m--) {
    int k;
    scanf("%d", &k);
    for (int i = 1; i <= k; i++) scanf("%d", arr + i), book[arr[i]] = 1;
    bool ok = 1;
    for (int i = 1; i <= k; i++) {
      if (book[fa[arr[i]]]) {
        puts("-1");
        ok = 0;
        for (int i = 1; i <= k; i++) book[arr[i]] = 0;
        break;
      }
    }
    if (!ok) continue;
    sort(arr + 1, arr + k + 1, cmp());
    int top = 1;
    st[1] = 1, he[1] = 0;
    tot = 1;
    ans = 0;
    for (int i = 1; i <= k; i++)
      if (arr[i] != 1) {
        int p = lca(arr[i], st[top]);
        if (p != st[top]) {
          while (id[p] < id[st[top - 1]]) add(st[top - 1], st[top]), top--;
          if (id[p] > id[st[top - 1]])
            he[p] = 0, add(p, st[top]), st[top] = p;
          else
            add(p, st[top--]);
        }
        he[arr[i]] = 0, st[++top] = arr[i];
      }
    while (top > 1) add(st[top - 1], st[top]), top--;
    dp(1);
    printf("%d\n", ans);
    for (int i = 1; i <= k; i++) book[arr[i]] = 0;
  }
}
void dp(int u) {
  int cnt = 0;
  for (int i = he[u]; i; i = nex[i]) {
    int& v = ver[i];
    dp(v);
    cnt += c[v];
  }
  if (book[u])
    c[u] = 1, ans += cnt;
  else if (cnt > 1)
    c[u] = 0, ans++;
  else
    c[u] = cnt;
}
int lca(int u, int v) {
  while (top[u] != top[v]) {
    if (dep[top[u]] < dep[top[v]]) swap(u, v);
    u = fa[top[u]];
  }
  return dep[u] < dep[v] ? u : v;
}
void dfs2(int u, int topf) {
  id[u] = ++ct, top[u] = topf;
  if (!son[u]) return;
  dfs2(son[u], topf);
  for (int i = he[u]; i; i = nex[i]) {
    int& v = ver[i];
    if (v == son[u] || v == fa[u]) continue;
    dfs2(v, v);
  }
}
void dfs1(int u) {
  dep[u] = dep[fa[u]] + 1, siz[u] = 1;
  for (int i = he[u]; i; i = nex[i]) {
    int& v = ver[i];
    if (v == fa[u]) continue;
    fa[v] = u;
    dfs1(v);
    siz[u] += siz[v];
    if (siz[son[u]] < siz[v]) son[u] = v;
  }
}
void add(int& u, int& v) {
  ver[tot] = v;
  nex[tot] = he[u];
  he[u] = tot++;
}
