#include <bits/stdc++.h>   #pragma GCC optimize( O3 ,  unroll-loops )   using namespace std;   template <class T>   inline void sort(T &a) {     sort((a).begin(), (a).end());   }   template <class T>   inline void rsort(T &a) {     sort((a).rbegin(), (a).rend());   }   template <class T>   inline void reverse(T &a) {     reverse((a).begin(), (a).end());   }   template <class T, class U>   inline void checkmin(T &x, U y) {     if (x > y) x = y;   }   template <class T, class U>   inline void checkmax(T &x, U y) {     if (x < y) x = y;   }   vector<vector<int>> rev, G;   void dfs(int v, int p = -1) {     for (auto &i : G[v])       if (i != p) {         rev[i].push_back(v);         dfs(i, v);       }   }   void solve() {     int n;     cin >> n;     G = vector<vector<int>>(n);     for (int i = 1; i < n; ++i) {       int u, v;       cin >> u >> v;       --u, --v;       G[u].push_back(v);       G[v].push_back(u);     }     int k1, k2;     cin >> k1;     vector<int> arr(k1);     for (auto &i : arr) cin >> i, --i;     cin >> k2;     vector<int> brr(k2);     for (auto &i : brr) cin >> i, --i;     vector<bool> used(n);     for (auto &i : arr) used[i] = true;     cout <<  B   << brr[0] + 1 << endl;     int y;     cin >> y;     --y;     rev = vector<vector<int>>(n);     dfs(y);     y = arr[0];     while (int(rev[y].size())) {       if (!used[rev[y][0]]) break;       y = rev[y][0];     }     int start = y;     cout <<  A   << y + 1 << endl;     cin >> y;     --y;     for (auto i : brr)       if (i == y) {         cout <<  C   << start + 1 << endl;         return;       }     cout <<  C   << -1 << endl;   }   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cout << fixed << setprecision(20);     srand(time(nullptr));     int q;     cin >> q;     while (q--) solve();     return 0;   }   