#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
vector<int> adj[N];
vector<int> kvec;
vector<int> adj2[N];
vector<int> po;
int tin[N];
int p[N][18], dep[N];
stack<int> vstack;
int dp[N][2];
int kmap[N];
bool cmpt(int a, int b) { return tin[a] < tin[b]; }
void dfsp(int f, int par, int d = 0) {
  p[f][0] = par;
  dep[f] = d;
  po.push_back(f);
  for (auto it : adj[f]) {
    if (it != par) dfsp(it, f, d + 1);
  }
}
int lca(int a, int b) {
  if (dep[a] < dep[b]) swap(a, b);
  for (int i = 17; i >= 0; i--) {
    if (p[a][i] != -1 && dep[p[a][i]] >= dep[b]) a = p[a][i];
  }
  if (a == b) return a;
  for (int i = 17; i >= 0; i--) {
    if (p[a][i] != -1 && p[b][i] != -1 && p[a][i] != p[b][i])
      a = p[a][i], b = p[b][i];
  }
  return p[a][0];
}
void dfsdp(int f, int par) {
  int numc = 0;
  for (auto it : adj2[f]) {
    if (it != par) {
      dfsdp(it, f);
      numc++;
    }
  }
  if (kmap[f]) {
    dp[f][0] = 1;
    dp[f][1] = 0;
    for (auto it : adj2[f]) {
      if (it != par) {
        dp[f][0] += dp[it][0];
        dp[f][1] += dp[it][0];
      }
    }
  } else {
    int c0 = 0, c1 = 1;
    for (auto it : adj2[f]) {
      if (it != par) {
        c0 += dp[it][0];
        c1 += dp[it][1] != -1 ? min(dp[it][0], dp[it][1]) : dp[it][0];
      }
    }
    dp[f][0] = min(c0, c1);
    dp[f][1] = 0;
    int best = 0;
    for (auto it : adj2[f]) {
      if (it != par) {
        if (dp[it][1] != -1) best = min(dp[it][1] - dp[it][0], best);
        dp[f][1] += dp[it][0];
      }
    }
    dp[f][1] += best;
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  dfsp(1, -1);
  for (int i = 1; i < 18; i++) {
    for (int j = 1; j <= n; j++) {
      if (p[j][i - 1] == -1)
        p[j][i] = -1;
      else
        p[j][i] = p[p[j][i - 1]][i - 1];
    }
  }
  for (int i = 0; i < n; i++) tin[po[i]] = i;
  int q;
  scanf("%d", &q);
  for (int i = 0; i < q; i++) {
    kvec.clear();
    int k;
    scanf("%d", &k);
    for (int j = 0; j < k; j++) {
      int ki;
      scanf("%d", &ki);
      kvec.push_back(ki);
    }
    sort(kvec.begin(), kvec.end(), cmpt);
    if (k == 1) {
      printf("0\n");
      continue;
    }
    vector<int> oldk = kvec;
    for (auto it : oldk) kmap[it] = 1;
    vector<int> lcp;
    for (int i = 0; i < k - 1; i++) {
      int a = kvec[i], b = kvec[i + 1];
      int ab = lca(a, b);
      lcp.push_back(ab);
    }
    for (auto it : lcp) kvec.push_back(it);
    sort(kvec.begin(), kvec.end(), cmpt);
    kvec.erase(unique(kvec.begin(), kvec.end()), kvec.end());
    while (!vstack.empty()) vstack.pop();
    int rt = kvec[0];
    vstack.push(rt);
    int sz = kvec.size();
    for (int i = 1; i < sz; i++) {
      while (lca(kvec[i], vstack.top()) != vstack.top()) vstack.pop();
      adj2[kvec[i]].push_back(vstack.top());
      adj2[vstack.top()].push_back(kvec[i]);
      vstack.push(kvec[i]);
    }
    dfsdp(rt, -1);
    int ans = dp[rt][0];
    if (dp[rt][1] != -1) ans = min(ans, dp[rt][1]);
    bool f = false;
    for (auto it : oldk) {
      if (p[it][0] != -1 && kmap[p[it][0]]) f = true;
    }
    for (auto it : oldk) {
      kmap[it] = 0;
    }
    for (auto it : kvec) {
      dp[it][0] = dp[it][1] = 0;
      adj2[it].clear();
    }
    if (!f)
      printf("%d\n", ans);
    else
      printf("-1\n");
  }
  return 0;
}
