#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, y = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') y = 1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
  return y ? -x : x;
}
template <typename T>
inline T read() {
  T x = 0;
  int y = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') y = 1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
  return y ? -x : x;
}
inline int ran() {
  static int seed = 703;
  return seed = int(seed * 48271LL % 2147483647);
}
namespace origin {
int seg[100005], top[100005], son[100005], fa[100005], deep[100005],
    siz[100005], h[100005], all, num;
struct edge {
  int pre, to;
} e[100005 << 1];
inline void add(int from, int to) {
  e[++num].pre = h[from], h[from] = num, e[num].to = to;
}
void dfs1(int node = 1) {
  siz[node] = 1;
  int x;
  for (register int i = h[node]; i; i = e[i].pre) {
    x = e[i].to;
    if (!siz[x]) {
      fa[x] = node, deep[x] = deep[node] + 1, dfs1(x), siz[node] += siz[x];
      if (siz[x] > siz[son[node]]) son[node] = x;
    }
  }
}
void dfs2(int node = 1) {
  seg[node] = ++all;
  if (son[node]) {
    top[son[node]] = top[node], dfs2(son[node]);
    int x;
    for (register int i = h[node]; i; i = e[i].pre) {
      x = e[i].to;
      if (!seg[x]) top[x] = x, dfs2(x);
    }
  }
}
int lca(int x, int y) {
  while (top[x] != top[y])
    deep[top[x]] < deep[top[y]] ? y = fa[top[y]] : x = fa[top[x]];
  return deep[x] < deep[y] ? x : y;
}
}  // namespace origin
namespace virt {
int h[100005], f[100005][2], num, n;
bool vis[100005], flag;
vector<int> p;
struct edge {
  int pre, to;
  bool l;
} e[100005 << 1];
inline void add(int from, int to) {
  bool l = (origin::fa[from] == to) || (origin::fa[to] == from);
  e[++num].pre = h[from], h[from] = num, e[num].to = to, e[num].l = l;
  e[++num].pre = h[to], h[to] = num, e[num].to = from, e[num].l = l;
}
inline bool cmp(int x, int y) { return origin::seg[x] < origin::seg[y]; }
struct Monostack {
  int sta[100005], top;
  void push(int x) { sta[++top] = x; }
  void clear() {
    for (register int i = 2; i <= top; ++i) add(sta[i], sta[i - 1]);
    top = 0;
  }
  void check(int x) {
    if (x == 1) return;
    int l = origin::lca(x, sta[top]);
    h[x] = 0;
    if (l != sta[top]) {
      while (origin::seg[l] < origin::seg[sta[top - 1]])
        add(sta[top], sta[top - 1]), --top;
      --top;
      if (l != sta[top])
        h[l] = 0, add(sta[top + 1], l), push(l);
      else
        add(sta[top + 1], l);
    }
    push(x);
  }
} s;
void dfs(int node = 1, int fa = 0) {
  f[node][0] = 0, f[node][1] = vis[node] * n;
  int x, siz = 0, rec = 0, sum;
  for (register int i = h[node]; i; i = e[i].pre) {
    x = e[i].to;
    if (x == fa) continue;
    siz += vis[x], dfs(x, node);
    if (vis[node]) {
      if (vis[x] && e[i].l) flag = 1;
      f[node][0] += min(f[x][1], f[x][0] + 1);
    } else {
      rec += min(f[x][0], f[x][1]);
      f[node][1] += f[x][1];
    }
  }
  if (!vis[node]) {
    f[node][0] = sum = f[node][1];
    f[node][1] = min(f[node][1], rec + 1);
    if (siz > 1) {
      f[node][0] = n;
      return;
    }
    for (register int i = h[node]; i; i = e[i].pre) {
      x = e[i].to;
      if (x == fa) continue;
      f[node][0] = min(f[node][0], sum - f[x][1] + f[x][0]);
    }
  }
}
void build() {
  h[1] = 0, s.push(1);
  for (vector<int>::iterator iter = p.begin(); iter != p.end(); ++iter)
    s.check(*iter);
  s.clear();
}
void solve() {
  p.clear(), flag = 0, n = read(), num = 0;
  int x;
  for (register int i = 1; i <= n; ++i) p.push_back(x = read()), vis[x] = 1;
  sort(p.begin(), p.end(), cmp);
  build(), dfs();
  printf("%d\n", flag ? -1 : min(f[1][0], f[1][1]));
  for (vector<int>::iterator iter = p.begin(); iter != p.end(); ++iter)
    vis[*iter] = 0;
}
}  // namespace virt
signed main() {
  using namespace origin;
  int n = read(), x, y;
  for (register int i = 1; i < n; ++i)
    x = read(), y = read(), add(x, y), add(y, x);
  dfs1(), dfs2(), n = read();
  while (n--) virt::solve();
}
