#include <bits/stdc++.h>
#pragma GCC optimize("O0")
using namespace std;
const int maxn = 1e5 + 10;
const int lgmx = 20;
vector<int> G[maxn];
bool vis[maxn];
int par[maxn][lgmx];
int hight[maxn];
int tin[maxn];
int tout[maxn];
int timer = 0;
int pr[maxn];
int imps_under[maxn];
int imps_removed[maxn];
bool isimp[maxn];
int dels = 0;
vector<int> kids[maxn];
void dfs(int v, int p, int h) {
  if (vis[v]) return;
  vis[v] = true;
  par[v][0] = p;
  hight[v] = h;
  tin[v] = timer++;
  for (int k = 1; k < lgmx; k++) par[v][k] = par[par[v][k - 1]][k - 1];
  for (int u : G[v]) dfs(u, v, h + 1);
  tout[v] = timer++;
}
void dfs2(int v) {
  vis[v] = true;
  imps_under[v] = isimp[v];
  for (int u : kids[v]) {
    if (vis[u]) continue;
    dfs2(u);
    imps_under[v] += imps_under[u];
  }
}
void dfs3(int v) {
  vis[v] = true;
  for (int u : kids[v]) {
    if (vis[u]) continue;
    dfs3(u);
    imps_removed[v] += imps_removed[u];
    if (isimp[u] and isimp[v]) {
      dels++;
      imps_removed[v]++;
    }
  }
  imps_under[v] -= imps_removed[v];
  if (!isimp[v]) {
    if (imps_under[v] > 1 or (imps_under[v] == 1 and isimp[pr[v]])) {
      imps_removed[v] += imps_under[v];
      dels++;
    }
  }
}
inline int get_par(int v, int k) {
  for (int i = lgmx; i--;)
    if ((k >> i) & 1) v = par[v][i];
  return v;
}
inline int lca(int v, int u) {
  if (hight[v] < hight[u]) swap(v, u);
  v = get_par(v, hight[v] - hight[u]);
  if (u == v) return v;
  for (int i = lgmx; i--;) {
    if (par[v][i] != par[u][i]) {
      v = par[v][i];
      u = par[u][i];
    }
  }
  return par[v][0];
}
inline bool cmp(int i, int j) { return tin[i] < tin[j]; }
inline bool is_anc(int x, int y) {
  if (tin[x] < tin[y] and tout[y] < tout[x]) return true;
  return false;
}
inline void delvis(vector<int> &ribbit) {
  for (int x : ribbit) vis[x] = false;
}
inline void end(vector<int> &ribbit) {
  for (int x : ribbit) {
    kids[x].clear();
    pr[x] = 0;
    imps_under[x] = 0;
    imps_removed[x] = 0;
    isimp[x] = false;
  }
  dels = 0;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    G[x].push_back(y);
    G[y].push_back(x);
  }
  dfs(0, 0, 0);
  memset(vis, 0, sizeof vis);
  int q;
  cin >> q;
  while (q--) {
    int k;
    cin >> k;
    vector<int> impcs(k);
    set<int> impcset;
    set<int> mpnts;
    vector<int> treenodes;
    set<int> availnodes;
    for (int i = 0; i < k; i++) {
      cin >> impcs[i];
      impcs[i]--;
      impcset.insert(impcs[i]);
      mpnts.insert(impcs[i]);
      isimp[impcs[i]] = true;
    }
    for (int i = 0; i < k; i++) {
      int x = impcs[i];
      if (par[x][0] != x and isimp[par[x][0]]) {
        dels = -1;
        break;
      }
    }
    if (dels == -1) {
      cout << -1 << endl;
      end(impcs);
      continue;
    }
    sort(impcs.begin(), impcs.end(), cmp);
    for (int i = 0; i < k - 1; i++) {
      int x = impcs[i];
      int y = impcs[i + 1];
      if (hight[x] < hight[y]) swap(x, y);
      int l = lca(x, y);
      if (l == y) continue;
      mpnts.insert(l);
    }
    for (int x : mpnts) treenodes.push_back(x);
    sort(treenodes.begin(), treenodes.end(), cmp);
    stack<int> st;
    for (int x : treenodes) {
      while ((!st.empty()) and (!is_anc(st.top(), x))) st.pop();
      if (st.empty())
        pr[x] = -1;
      else
        pr[x] = st.top();
      st.push(x);
    }
    for (int x : treenodes)
      if (!kids[x].empty()) exit(1);
    for (int x : treenodes) {
      if (pr[x] != -1) {
        kids[pr[x]].push_back(x);
      }
    }
    delvis(treenodes);
    dfs2(treenodes[0]);
    delvis(treenodes);
    dfs3(treenodes[0]);
    cout << dels << endl;
    end(treenodes);
    end(impcs);
  }
  cerr << "Fuuuuuuuuuuuuuuuuuuuuuuuuuuuck" << endl;
  return 0;
}
