#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, q[N], m;
vector<int> v[N], g[N];
int f[N][20], dep[N], dfn[N], didx;
void dfs(int pos, int fa) {
  dep[pos] = dep[fa] + 1;
  f[pos][0] = fa;
  dfn[pos] = ++didx;
  for (int i = 1; i < 20; i++) f[pos][i] = f[f[pos][i - 1]][i - 1];
  for (auto &i : v[pos])
    if (i != fa) dfs(i, pos);
}
int lca(int a, int b) {
  if (dep[a] < dep[b]) swap(a, b);
  for (int i = 19; i >= 0; --i)
    if (dep[f[a][i]] >= dep[b]) a = f[a][i];
  if (a == b) return a;
  for (int i = 19; i >= 0; --i)
    if (f[a][i] != f[b][i]) a = f[a][i], b = f[b][i];
  return f[a][0];
}
bool vis[N];
int dp[N], sz[N];
int dfs2(int pos) {
  int ret = 0;
  sz[pos] = 0;
  for (auto &i : g[pos]) ret += dfs2(i), sz[pos] += sz[i];
  if (vis[pos])
    ret += sz[pos], sz[pos] = 1;
  else if (sz[pos] > 1)
    sz[pos] = 0, ++ret;
  g[pos].clear();
  return ret;
}
int stk[N], top;
int calc() {
  for (int i = 1; i <= m; i++) assert(!vis[q[i]]), vis[q[i]] = 1;
  for (int i = 1; i <= m; i++)
    if (vis[f[q[i]][0]]) {
      for (int j = 1; j <= m; j++) vis[q[j]] = 0;
      return -1;
    }
  sort(q + 1, q + m + 1, [](int a, int b) { return dfn[a] < dfn[b]; });
  top = 0;
  stk[++top] = 1;
  for (int i = 1; i <= m; i++) {
    int x = lca(stk[top], q[i]);
    while (dep[x] < dep[stk[top]]) {
      if (dep[x] >= dep[stk[top - 1]]) {
        g[x].push_back(stk[top--]);
        if (stk[top] != x) stk[++top] = x;
        break;
      }
      int t1 = stk[top], t2 = stk[top - 1];
      --top;
      g[t2].push_back(t1);
    }
    if (stk[top] != q[i]) stk[++top] = q[i];
  }
  while (top > 1) g[stk[top - 1]].push_back(stk[top]), --top;
  int ans = dfs2(1);
  for (int i = 1; i <= m; i++) vis[q[i]] = 0;
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  int t1, t2;
  for (int i = 1; i < n; i++) {
    cin >> t1 >> t2;
    v[t1].push_back(t2);
    v[t2].push_back(t1);
  }
  dfs(1, 0);
  int _;
  cin >> _;
  while (_--) {
    cin >> m;
    for (int i = 1; i <= m; i++) cin >> q[i];
    cout << calc() << endl;
  }
  return 0;
}
