#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 10;
template <typename Tp>
void read(Tp &x) {
  x = 0;
  int op = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') op = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= op;
}
template <typename Tp>
void CMax(Tp &x, Tp y) {
  if (y > x) x = y;
}
template <typename Tp>
void CMin(Tp &x, Tp y) {
  if (y < x) x = y;
}
int head[N], nxt[N << 1], to[N << 1], tot;
void add_edge(int x, int y) {
  to[++tot] = y;
  nxt[tot] = head[x];
  head[x] = tot;
}
void add(int x, int y) {
  add_edge(x, y);
  add_edge(y, x);
}
int fa[N], siz[N], dep[N], son[N], Top[N], dfn[N], dfc;
void dfs1(int x) {
  dep[x] = dep[fa[x]] + 1;
  siz[x] = 1;
  for (int i = head[x]; i; i = nxt[i]) {
    int y = to[i];
    if (y == fa[x]) continue;
    fa[y] = x;
    dfs1(y);
    siz[x] += siz[y];
    if (siz[y] > siz[son[x]]) son[x] = y;
  }
}
void dfs2(int x, int topfa) {
  Top[x] = topfa;
  dfn[x] = ++dfc;
  if (son[x]) dfs2(son[x], topfa);
  for (int i = head[x]; i; i = nxt[i]) {
    int y = to[i];
    if (y == fa[x] || y == son[x]) continue;
    dfs2(y, y);
  }
}
int LCA(int x, int y) {
  while (Top[x] != Top[y]) {
    if (dep[Top[x]] >= dep[Top[y]])
      x = fa[Top[x]];
    else
      y = fa[Top[y]];
  }
  if (dep[x] <= dep[y])
    return x;
  else
    return y;
}
int stk[N], top;
vector<int> T[N];
bool cmp(int x, int y) { return dfn[x] < dfn[y]; }
void connect(int x, int y) { T[x].push_back(y); }
void Insert(int x) {
  if (top <= 1) {
    stk[++top] = x;
    return;
  }
  int lca = LCA(x, stk[top]);
  while (top > 1 && dfn[stk[top - 1]] >= dfn[lca]) {
    connect(stk[top - 1], stk[top]);
    top--;
  }
  if (lca != stk[top]) connect(lca, stk[top]), stk[top] = lca;
  stk[++top] = x;
}
int ans, f[N];
void DP(int x) {
  if (f[x]) {
    for (auto y : T[x]) {
      DP(y);
      if (f[y]) f[y] = 0, ans++;
    }
  } else {
    for (auto y : T[x]) {
      DP(y);
      f[x] += f[y];
      f[y] = 0;
    }
    if (f[x] > 1) ans++, f[x] = 0;
  }
  T[x].clear();
}
int n, Q, k, key[N];
int main() {
  read(n);
  int x, y;
  for (int i = (2); i <= (n); ++i) {
    read(x);
    read(y);
    add(x, y);
  }
  dfs1(1);
  dfs2(1, 1);
  read(Q);
  while (Q--) {
    read(k);
    for (int i = (1); i <= (k); ++i) read(key[i]), f[key[i]] = 1;
    bool flag = true;
    for (int i = (1); i <= (k); ++i) {
      if (f[fa[key[i]]]) {
        puts("-1");
        flag = false;
        for (int j = (1); j <= (k); ++j) f[key[j]] = 0;
        break;
      }
    }
    if (!flag) continue;
    sort(key + 1, key + k + 1, cmp);
    top = 0;
    if (key[1] != 1) stk[++top] = 1;
    for (int i = (1); i <= (k); ++i) Insert(key[i]);
    while (top > 1) connect(stk[top - 1], stk[top]), top--;
    ans = 0;
    DP(1);
    f[1] = 0;
    printf("%d\n", ans);
  }
  return 0;
}
