#include <bits/stdc++.h>
using namespace std;
const int iol = 1024 * 1024;
char buf[iol], *ioh, *iot, ioc;
bool iosig;
inline char read() {
  if (ioh == iot) {
    iot = (ioh = buf) + fread(buf, 1, iol, stdin);
    if (ioh == iot) return -1;
  }
  return *ioh++;
}
template <class T>
inline bool read(T &x) {
  iosig = false;
  for (ioc = read(); !isdigit(ioc); ioc = read()) {
    if (ioc == -1) return false;
    if (ioc == '-') iosig = true;
  }
  x = 0;
  while (ioc == '0') ioc = read();
  for (; isdigit(ioc); ioc = read()) x = (x << 1) + (x << 3) + (ioc ^ '0');
  ioh--;
  if (iosig) x = -x;
  return true;
}
const int MAXN = 2e5 + 10;
int n, q, m, ans, tim, tag, f[MAXN][20], d[20], dfn[MAXN], a[MAXN], mark[MAXN],
    dep[MAXN], stk[MAXN];
vector<pair<int, int> > G[MAXN];
vector<int> E[MAXN];
bool ok;
void dfs(int x, int fa) {
  f[x][0] = fa;
  dfn[x] = ++tim;
  dep[x] = dep[fa] + 1;
  for (int &i : E[x])
    if (i != fa) dfs(i, x);
  E[x].clear();
}
inline bool cmp(int i, int j) { return dfn[i] < dfn[j]; }
void remove(int x) {
  for (auto &i : G[x]) remove(i.first);
  G[x].clear();
}
inline int getlca(int a, int b) {
  if (dep[a] < dep[b]) swap(a, b);
  for (register int i = 19; i >= 0; i--)
    if (dep[f[a][i]] >= dep[b]) a = f[a][i];
  if (a == b) return a;
  for (register int i = 19; i >= 0; i--)
    if (f[a][i] != f[b][i]) a = f[a][i], b = f[b][i];
  return f[a][0];
}
bool dfs(int x, int f, int w) {
  if (mark[x] == mark[f] && mark[x] == tag && w == 1) ok = 0;
  register int t = 0;
  for (auto &i : G[x])
    if (dfs(i.first, x, i.second)) t++;
  if (mark[x] == tag) {
    ans += t;
    return true;
  } else {
    if (t == 0) return false;
    if (t == 1) return true;
    ans++;
    return false;
  }
}
int main() {
  read(n);
  for (register int i = 1; i < n; i++) {
    register int x, y;
    read(x), read(y);
    E[x].push_back(y);
    E[y].push_back(x);
  }
  dfs(1, 0);
  for (register int i = 1; i < 20; i++)
    for (register int j = 1; j <= n; j++) f[j][i] = f[f[j][i - 1]][i - 1];
  read(q);
  while (q--) {
    ++tag;
    ok = 1, ans = 0;
    read(m);
    for (register int i = 1; i <= m; i++) read(a[i]), mark[a[i]] = tag;
    sort(a + 1, a + 1 + m, cmp);
    register int top = 1;
    stk[top] = 0;
    for (register int i = 1; i <= m; i++) {
      register int x = a[i];
      register int lca = getlca(x, stk[top]);
      while (top > 1 && dfn[lca] < dfn[stk[top - 1]]) {
        G[stk[top - 1]].push_back(
            {stk[top], dep[stk[top]] - dep[stk[top - 1]]});
        top--;
      }
      if (stk[top] != lca) {
        G[lca].push_back({stk[top], dep[stk[top]] - dep[lca]});
        top--;
        if (stk[top] != lca) stk[++top] = lca;
      }
      stk[++top] = x;
    }
    while (top > 1)
      G[stk[top - 1]].push_back({stk[top], dep[stk[top]] - dep[stk[top - 1]]}),
          top--;
    dfs(0, 0, 0);
    if (!ok)
      cout << "-1\n";
    else
      cout << ans << "\n";
    remove(0);
  }
}
