#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18L;
const int inf = 0x3f3f3f3f;
const int maxn = 100005;
const int Mod = 1e9 + 7;
struct E {
  int v, next;
} edge[maxn * 2];
int head[maxn], tot;
void init() {
  memset(head, -1, sizeof(head));
  tot = 0;
}
void addedge(int u, int v) {
  edge[tot].v = v;
  edge[tot].next = head[u];
  head[u] = tot++;
}
int dep[maxn], fa[maxn][20], dfn[maxn], cnt, last[maxn];
void dfs(int u, int father) {
  fa[u][0] = father;
  for (int i = 1; i < 20; i++) fa[u][i] = fa[fa[u][i - 1]][i - 1];
  dfn[u] = ++cnt;
  for (int i = head[u]; i != -1; i = edge[i].next) {
    int v = edge[i].v;
    if (v == father) continue;
    dep[v] = dep[u] + 1;
    dfs(v, u);
  }
  last[u] = cnt;
}
int lca(int u, int v) {
  if (dep[u] > dep[v]) swap(u, v);
  for (int i = 19; i >= 0; i--)
    if (dep[u] <= dep[fa[v][i]]) v = fa[v][i];
  if (u == v) return u;
  for (int i = 19; i >= 0; i--) {
    if (fa[u][i] == fa[v][i]) continue;
    u = fa[u][i];
    v = fa[v][i];
  }
  return fa[u][0];
}
int a[maxn * 2], k, b[maxn], sz;
int n, q, pre[maxn];
int sta[maxn], top;
bool imp[maxn];
bool cmp(int x, int y) { return dfn[x] < dfn[y]; }
int dp[maxn], num[maxn];
void solve() {
  sort(a, a + k, cmp);
  for (int i = k - 1; i >= 1; i--) a[k++] = lca(a[i], a[i - 1]);
  sort(a, a + k, cmp);
  k = unique(a, a + k) - a;
  top = 0;
  sta[++top] = a[0];
  for (int i = 1; i < k; i++) {
    while (last[sta[top]] < dfn[a[i]]) top--;
    pre[a[i]] = sta[top];
    if (dep[a[i]] - dep[sta[top]] == 1 && imp[sta[top]] && imp[a[i]]) {
      cout << -1 << endl;
      return;
    }
    sta[++top] = a[i];
  }
  for (int i = 0; i < k; i++) dp[a[i]] = num[a[i]] = 0;
  for (int i = k - 1; i >= 1; i--) {
    if (imp[a[i]]) {
      dp[a[i]] += num[a[i]];
      num[pre[a[i]]]++;
    } else {
      if (num[a[i]] > 1) dp[a[i]]++;
      if (num[a[i]] == 1) num[pre[a[i]]]++;
    }
    dp[pre[a[i]]] += dp[a[i]];
  }
  if (imp[a[0]])
    dp[a[0]] += num[a[0]];
  else if (num[a[0]] > 1)
    dp[a[0]]++;
  cout << dp[a[0]] << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  init();
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    addedge(u, v);
    addedge(v, u);
  }
  dep[1] = 1;
  dfs(1, 0);
  cin >> q;
  while (q--) {
    cin >> k;
    for (int i = 0; i < k; i++) {
      cin >> a[i];
      b[i] = a[i];
      imp[b[i]] = true;
    }
    sz = k;
    solve();
    while (sz) imp[b[--sz]] = false;
  }
  return 0;
}
