#include <bits/stdc++.h>
using namespace std;
vector<int> v[100010], v2[100010];
int n, q, dfn[100010], tim, p[100010], dep[100010], st[100010][17];
map<pair<int, int>, int> mp;
void dfs1(int np, int fath) {
  dfn[np] = ++tim;
  dep[np] = dep[fath] + 1;
  st[np][0] = fath;
  for (int i = 1; i < 17; i++) st[np][i] = st[st[np][i - 1]][i - 1];
  for (int &x : v[np]) {
    if (x == fath) continue;
    dfs1(x, np);
  }
}
inline int lca(int x, int y) {
  if (dep[x] < dep[y]) swap(x, y);
  for (int i = 16; i >= 0; i--)
    if (dep[st[x][i]] >= dep[y]) x = st[x][i];
  if (x == y) return x;
  for (int i = 16; i >= 0; i--)
    if (st[x][i] != st[y][i]) x = st[x][i], y = st[y][i];
  return st[x][0];
}
int ans = 0, stk[100010], top;
bool flag[100010];
bool dfs2(int np) {
  if (flag[np]) {
    for (int &x : v2[np]) {
      if (dfs2(x)) {
        if (dep[x] == dep[np] + 1 && flag[x]) {
          ans = -1e9;
        } else
          ans++;
      }
    }
    return 1;
  } else {
    int tot = 0;
    for (int &x : v2[np]) tot += dfs2(x);
    if (tot >= 2) {
      ans++;
      return 0;
    }
    if (tot) return 1;
    return 0;
  }
}
void dfs3(int np, int fath) {
  for (int &x : v2[np]) {
    if (x == fath) continue;
    dfs3(x, np);
  }
  v2[np].clear();
}
inline int cmp(int x, int y) { return dfn[x] < dfn[y]; }
int main() {
  scanf("%d", &n);
  for (int i = 1, ti, tj; i < n; i++) {
    scanf("%d%d", &ti, &tj);
    v[ti].push_back(tj);
    v[tj].push_back(ti);
    mp[make_pair(ti, tj)] = mp[make_pair(tj, ti)] = 1;
  }
  dfs1(1, 0);
  scanf("%d", &q);
  while (q--) {
    int K;
    scanf("%d", &K);
    for (int i = 1; i <= K; i++) scanf("%d", &p[i]);
    sort(p + 1, p + K + 1, cmp);
    for (int i = 1; i <= K; i++) flag[p[i]] = 1;
    top = 0;
    if (p[1] != 1) stk[++top] = 1;
    for (int i = 1; i <= K; i++) {
      while (top > 1 && dfn[lca(stk[top], p[i])] <= dfn[stk[top - 1]]) {
        v2[stk[top - 1]].push_back(stk[top]);
        top--;
      }
      if (top) {
        int L = lca(stk[top], p[i]);
        if (L != stk[top]) {
          v2[L].push_back(stk[top]);
          stk[top] = L;
        }
      }
      stk[++top] = p[i];
    }
    while (top > 1) v2[stk[top - 1]].push_back(stk[top]), top--;
    ans = 0;
    dfs2(1);
    if (ans >= 0)
      printf("%d\n", ans);
    else
      puts("-1");
    dfs3(1, 0);
    for (int i = 1; i <= K; i++) flag[p[i]] = 0;
  }
  return 0;
}
