#include <bits/stdc++.h>
namespace FastIO {
bool IOerror = 0;
inline char nc() {
  static char buf[100000], *p1 = buf + 100000, *pend = buf + 100000;
  if (p1 == pend) {
    p1 = buf;
    pend = buf + fread(buf, 1, 100000, stdin);
    if (pend == p1) {
      IOerror = 1;
      return -1;
    }
  }
  return *p1++;
}
inline bool blank(char ch) {
  return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t';
}
template <class T>
inline bool read(T& x) {
  bool sign = 0;
  char ch = nc();
  x = 0;
  for (; blank(ch); ch = nc())
    ;
  if (IOerror) return false;
  if (ch == '-') sign = 1, ch = nc();
  for (; ch >= '0' && ch <= '9'; ch = nc()) x = x * 10 + ch - '0';
  if (sign) x = -x;
  return true;
}
template <class T, class... U>
bool read(T& h, U&... t) {
  return read(h) && read(t...);
}
};  // namespace FastIO
using namespace std;
using namespace FastIO;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int INF = 0x3f3f3f3f;
const int N = 1e5 + 10;
vector<long long> e[N];
long long dep[N], f[N], top[N], son[N], siz[N], dfn[N], tim;
void dfs1(long long u, long long fa) {
  dep[u] = dep[fa] + 1;
  siz[u] = 1;
  son[u] = 0;
  f[u] = fa;
  for (auto v : e[u]) {
    if (v == fa) continue;
    dfs1(v, u);
    siz[u] += siz[v];
    if (siz[v] > siz[son[u]]) son[u] = v;
  }
}
void dfs2(long long u, long long t) {
  top[u] = t;
  dfn[u] = ++tim;
  if (!son[u]) return;
  dfs2(son[u], t);
  for (auto v : e[u]) {
    if (v == f[u] || v == son[u]) continue;
    dfs2(v, v);
  }
}
long long getlca(long long x, long long y) {
  while (top[x] != top[y]) {
    if (dep[top[x]] < dep[top[y]]) swap(x, y);
    x = f[top[x]];
  }
  if (dep[x] > dep[y]) swap(x, y);
  return x;
}
vector<long long> new_e[N];
long long st[N], Top;
void add(long long u, long long v) { new_e[u].push_back(v); }
void insert(long long x) {
  if (Top <= 1) {
    st[++Top] = x;
    return;
  }
  long long lca = getlca(x, st[Top]);
  if (lca == st[Top]) {
    st[++Top] = x;
    return;
  }
  while (Top > 1 && dfn[st[Top - 1]] >= dfn[lca]) {
    add(st[Top - 1], st[Top]);
    --Top;
  }
  if (lca != st[Top]) add(lca, st[Top]), st[Top] = lca;
  st[++Top] = x;
}
long long dp[N], vis[N], num[N];
long long dfs(long long u) {
  long long ans = 0;
  for (auto v : new_e[u]) {
    ans += dfs(v);
    num[u] += num[v];
  }
  if (vis[u]) {
    ans += num[u];
    num[u] = 1;
  } else {
    if (num[u] > 1) {
      ans++;
      num[u] = 0;
    }
  }
  return ans;
}
void del(long long u) {
  num[u] = 0;
  vis[u] = 0;
  for (auto v : new_e[u]) del(v);
  new_e[u].clear();
}
signed main() {
  long long n, q;
  read(n);
  for (long long i = 1; i < n; i++) {
    long long u, v;
    read(u, v);
    e[u].push_back(v);
    e[v].push_back(u);
  }
  dfs1(1, 0);
  dfs2(1, 1);
  read(q);
  while (q--) {
    long long m;
    vector<long long> tmp;
    read(m);
    for (long long i = 1; i <= m; i++) {
      long long x;
      read(x);
      vis[x] = 1;
      tmp.push_back(x);
    }
    sort((tmp).begin(), (tmp).end(),
         [](long long x, long long y) { return dfn[x] < dfn[y]; });
    long long flag = 0;
    for (auto i : tmp)
      if (vis[f[i]]) flag = 1;
    if (flag) {
      for (auto i : tmp) vis[i] = 0;
      puts("-1");
      continue;
    }
    Top = 0;
    if (!vis[1]) st[++Top] = 1;
    for (auto i : tmp) insert(i);
    while (Top > 1) {
      add(st[Top - 1], st[Top]);
      --Top;
    }
    printf("%d\n", dfs(1));
    del(1);
  }
  return 0;
}
