#include <bits/stdc++.h>
using namespace std;
const double eps = 0.000000000000001;
const int N = 100010;
vector<int> gr[N];
int n, q, f = 1;
int lev[N] = {0}, dp[N][20], lgn = 0;
int st[N], tim = 0, mrk[N], en[N];
void dfs(int c, int p) {
  int z, i = 0;
  z = gr[c].size();
  lev[c] = lev[p] + 1;
  dp[c][0] = p;
  st[c] = ++tim;
  for (i = 0; i < z; i++) {
    int v = gr[c][i];
    if (v == p) continue;
    dfs(v, c);
  }
  en[c] = tim;
}
void pre() {
  int i, j;
  for (lgn = 0; (1 << lgn) <= n; lgn++)
    ;
  for (j = 1; j <= lgn; j++) {
    for (i = 1; i <= n; i++) {
      dp[i][j] = dp[dp[i][j - 1]][j - 1];
    }
  }
}
inline int lca(int a, int b) {
  if (a == b) return a;
  if (lev[a] < lev[b]) swap(a, b);
  int i, j;
  if (lev[a] > lev[b])
    for (i = lgn; i >= 0; i--)
      if (lev[a] - (1 << i) >= lev[b]) a = dp[a][i];
  if (a == b) return a;
  for (i = lgn; i >= 0; i--)
    if (dp[a][i] != dp[b][i]) {
      a = dp[a][i];
      b = dp[b][i];
    }
  return dp[a][0];
}
vector<int> g[N];
int par[N];
int ans = 0;
int doit(int c, int p) {
  int i, z = g[c].size(), ret = 0;
  int dh = 0;
  for (i = 0; i < z; i++) {
    if (g[c][i] == p) continue;
    dh += (doit(g[c][i], c));
  }
  if (mrk[c]) {
    ans += dh;
    ret = 1;
  } else {
    if (dh > 1) {
      ans += 1;
      ret = 0;
    } else {
      ret = dh;
    }
  }
  assert(ret <= 1);
  return ret;
}
int main() {
  scanf("%d", &n);
  int i, j;
  for (i = 0; i < n - 1; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    gr[x].push_back(y);
    gr[y].push_back(x);
  }
  dfs(1, 0);
  pre();
  int q;
  scanf("%d", &q);
  vector<int> vv;
  while (q--) {
    int k;
    scanf("%d", &k);
    vector<pair<int, int> > v;
    f = 1;
    for (i = 0; i < vv.size(); i++) {
      g[vv[i]].clear();
      mrk[vv[i]] = 0;
      par[vv[i]] = 0;
    }
    vv.clear();
    for (i = 0; i < k; i++) {
      int x;
      scanf("%d", &x);
      vv.push_back(x);
      mrk[x] = 1;
      v.push_back(make_pair(st[x], x));
    }
    sort(v.begin(), v.end());
    for (i = 0; i < k; i++) {
      int x = v[i].second;
      if (mrk[dp[x][0]] == 1) {
        f = 0;
        break;
      }
    }
    if (!f) {
      printf("-1\n");
      continue;
    }
    int lv = INT_MAX, nod = -1;
    for (i = 0; i < k; i++) {
      int x = v[i].second, y = v[(i + 1) % k].second;
      int cc = lca(x, y);
      v.push_back(make_pair(st[cc], cc));
      vv.push_back(cc);
    }
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    stack<int> sst;
    for (i = 0; i < v.size(); i++) {
      while (!sst.empty() &&
             !(st[sst.top()] <= v[i].first && v[i].first <= en[sst.top()])) {
        sst.pop();
      }
      if (!sst.empty()) {
        par[v[i].second] = sst.top();
        g[sst.top()].push_back(v[i].second);
        g[v[i].second].push_back(sst.top());
      }
      sst.push(v[i].second);
    }
    ans = 0;
    doit(v[0].second, 0);
    printf("%d\n", ans);
  }
  return 0;
}
