#include <bits/stdc++.h>
using namespace std;
const int MX = 100005;
const int L = 20;
const int INF = 1111111111;
vector<int> con[MX << 1];
int newn;
int vis[MX], st[MX], en[MX], dp[MX];
int dotn, id[MX];
int anc[MX][L], prv[MX];
int rt[MX], rtn;
int val[2][MX], chk[2][MX];
struct node {
  int v, st, en, imp;
  node(int v = 0, int st = 0, int en = 0, int imp = 0)
      : v(v), st(st), en(en), imp(imp) {}
  bool operator<(const node &d) const {
    if (st != d.st) return st < d.st;
    return imp > d.imp;
  }
  bool operator==(const node &d) const { return st == d.st; }
} dot[MX << 1];
void dfs(int u) {
  st[u] = ++newn;
  vis[u] = true;
  for (int v : con[u])
    if (!vis[v]) prv[v] = u, dp[v] = dp[u] + 1, dfs(v);
  en[u] = newn;
}
void preprocess() {
  for (int i = 0; i < MX; i++) anc[i][0] = prv[i];
  for (int i = 1; i < L; i++) {
    for (int j = 0; j < MX; j++) anc[j][i] = anc[anc[j][i - 1]][i - 1];
  }
}
int LCA(int u, int v) {
  if (dp[u] < dp[v]) swap(u, v);
  for (int i = L - 1; i >= 0; i--) {
    if (dp[anc[u][i]] >= dp[v]) u = anc[u][i];
    if (u == v) return u;
  }
  for (int i = L - 1; i >= 0; i--) {
    if (anc[u][i] != anc[v][i]) u = anc[u][i], v = anc[v][i];
  }
  return anc[u][0];
}
int can(int id, int u) {
  if (chk[id][u]) return val[id][u];
  chk[id][u] = true;
  if (!id && dot[u].imp) return val[id][u] = INF;
  int res = 0, flg = 0;
  for (int v : con[u]) {
    if (dot[u].imp && dot[v].imp && dp[dot[u].v] == dp[dot[v].v] - 1)
      return val[id][u] = INF;
    int val1 = can(0, v), val2 = can(1, v);
    int now = INF;
    if (now > val1) now = val1;
    if (now > val2) {
      now = val2;
      if (dot[u].imp)
        now++;
      else
        flg = 1;
    }
    if (now == INF) return val[id][u] = INF;
    res += now;
  }
  res += flg;
  if (!id || dot[u].imp) return val[id][u] = res;
  res = flg = 0;
  for (int v : con[u]) {
    int val1 = can(0, v), val2 = can(1, v);
    int now = INF;
    if (now > val1) now = val1;
    if (!dot[v].imp) {
      if (now > val2 + 1) now = val2 + 1;
    } else {
      if (dp[dot[u].v] == dp[dot[v].v] - 1) {
        flg++;
        if (now > val2 + 1) now = val2;
      } else if (now > val2 + 1)
        now = val2 + 1;
    }
    res += now;
  }
  if (flg > 1)
    return val[id][u] = INF;
  else if (flg)
    return val[id][u] = res;
  int ans = INF;
  for (int v : con[u]) {
    int val1 = can(0, v), val2 = can(1, v);
    if (val2 == INF) continue;
    if (val1 == INF) {
      ans = min(ans, res - 1);
    } else {
      if (val1 < val2 + 1)
        ans = min(ans, res - val1 + val2);
      else
        ans = min(ans, res - 1);
    }
  }
  return val[id][u] = ans;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    con[u].push_back(v), con[v].push_back(u);
  }
  dp[1] = 1;
  dfs(1);
  preprocess();
  int q;
  scanf("%d", &q);
  while (q--) {
    dotn = 0;
    scanf("%d", &n);
    for (int i = 0; i < 2 * n; i++) con[i].clear(), chk[0][i] = chk[1][i] = 0;
    for (int i = 0; i < n; i++) {
      int u;
      scanf("%d", &u);
      dot[dotn++] = node(u, st[u], en[u], 1);
    }
    sort(dot, dot + dotn);
    for (int i = 0; i < n - 1; i++) {
      int u = LCA(dot[i].v, dot[i + 1].v);
      dot[dotn++] = node(u, st[u], en[u]);
    }
    sort(dot, dot + dotn);
    dotn = unique(dot, dot + dotn) - dot;
    rtn = 0;
    for (int i = 0; i < dotn; i++) {
      while (rtn) {
        int u = rt[rtn - 1];
        if (dot[u].st <= dot[i].st && dot[i].en <= dot[u].en) {
          con[u].push_back(i);
          break;
        }
        rtn--;
      }
      rt[rtn++] = i;
    }
    int ans = 0;
    for (int i = 0; i < dotn; i++)
      if (!chk[0][i]) {
        int now = min(can(0, i), can(1, i));
        if (now == INF) {
          ans = -1;
          break;
        }
        ans += now;
      }
    printf("%d\n", ans);
  }
  return 0;
}
