#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 1e5 + 233;
int cnt = 0;
int dfn[MAXN];
int n;
vector<int> g[MAXN];
int depth[MAXN];
int in[MAXN], out[MAXN], fa[MAXN][17];
int tot = 0;
void dfs(int now, int pre, int dep = 0) {
  dfn[now] = ++cnt;
  in[now] = ++tot;
  depth[now] = dep;
  fa[now][0] = pre;
  for (int i = 1; i <= 16; ++i) fa[now][i] = fa[fa[now][i - 1]][i - 1];
  for (auto it : g[now])
    if (it != pre) dfs(it, now, dep + 1);
  out[now] = ++tot;
}
int lg[1 << 17];
int climb(int x, int y) {
  while (y) {
    x = fa[x][lg[y & (-y)]];
    y ^= y & (-y);
  }
  return x;
}
int lca(int u, int v) {
  if (depth[u] > depth[v]) swap(u, v);
  v = climb(v, depth[v] - depth[u]);
  if (u == v) return u;
  for (int i = 16; i >= 0; --i)
    if (fa[u][i] != fa[v][i]) {
      u = fa[u][i], v = fa[v][i];
    }
  return fa[u][0];
}
bool cmp(int A, int B) { return dfn[A] < dfn[B]; }
vector<int> vg[MAXN];
int vn;
vector<int> nodes;
int get(int now) {
  for (int i = now + 1; i < vn; ++i) {
    if (out[nodes[i]] <= out[nodes[now]] && in[nodes[i]] >= in[nodes[now]]) {
      vg[nodes[now]].push_back(nodes[i]);
      i = get(i);
    } else {
      return i - 1;
    }
  }
  return vn - 1;
}
void v_tree(vector<int> v) {
  sort(v.begin(), v.end(), cmp);
  for (int i = 0; i < v.size(); ++i) {
    if (v[i] != 1) nodes.push_back(fa[v[i]][0]);
    nodes.push_back(v[i]);
  }
  for (int i = 0; i < v.size(); ++i)
    if (i) {
      nodes.push_back(lca(v[i - 1], v[i]));
    }
  sort(nodes.begin(), nodes.end());
  nodes.erase(unique(nodes.begin(), nodes.end()), nodes.end());
  sort(nodes.begin(), nodes.end(), cmp);
  vn = nodes.size();
  get(0);
}
bool vis[MAXN][2];
int dp[MAXN][2];
void clear_() {
  for (auto it : nodes)
    vis[it][0] = vis[it][1] = 0, dp[it][0] = dp[it][1] = INF;
  for (auto it : nodes) vg[it].clear();
  nodes.clear();
}
bool bad[MAXN];
int trans(int now, bool ty) {
  vis[now][ty] = true;
  int& ret = dp[now][ty];
  int two[2][2];
  int pre_ = 0, now_ = 1;
  two[pre_][0] = 0;
  two[pre_][1] = INF;
  for (auto it : vg[now]) {
    two[now_][0] = two[now_][1] = INF;
    for (int i = 0; i < 2; ++i) {
      int val = (vis[it][i] ? dp[it][i] : trans(it, i));
      for (int j = 0; j < 2; ++j) {
        if (i && j && ty) continue;
        two[now_][i | j] = min(two[now_][i | j], two[pre_][j] + val);
      }
    }
    swap(pre_, now_);
  }
  if (ty) {
    if (bad[now]) {
      ret = min(ret, two[pre_][0]);
    } else {
      ret = min(ret, two[pre_][1]);
    }
  } else {
    if (!bad[now]) {
      ret = min(ret, two[pre_][0]);
      ret = min(ret, two[pre_][1] + 1);
    }
  }
  return ret;
}
int main() {
  memset(dp, 63, sizeof(dp));
  int q;
  scanf("%d", &n);
  for (int i = 1; i <= n - 1; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(1, 0);
  for (int i = 0; i <= 16; ++i) lg[1 << i] = i;
  scanf("%d", &q);
  for (int T = 1; T <= q; ++T) {
    int m;
    scanf("%d", &m);
    vector<int> que;
    for (int i = 1; i <= m; ++i) {
      int ai;
      scanf("%d", &ai);
      que.push_back(ai);
    }
    clear_();
    v_tree(que);
    int root = nodes[0];
    for (auto it : que) bad[it] = true;
    int rest = min(trans(root, 0), trans(root, 1));
    if (rest == INF) rest = -1;
    printf("%d\n", rest);
    for (auto it : que) bad[it] = false;
  }
  return 0;
}
