#include <bits/stdc++.h>
using namespace std;
template <typename Tp>
inline void outarr(Tp _array, const std::size_t _N, const char* _delim = " ") {
  Tp end = std::next(_array, _N);
  for (Tp current = _array; current != end; ++current) {
    std::cout << *current << _delim;
  }
  std::cout << '\n';
}
using ll = int64_t;
using pii = std::pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr int MOD = static_cast<const int>(1e9 + 7);
int myv[1000];
int liv[1000];
set<int> setmy;
set<int> setli;
const int GSIZE = 1010;
int tIn[GSIZE];
int tOut[GSIZE];
int prnt[GSIZE];
vector<int> gr[GSIZE];
int T = 0;
void Dfs(int v, int p = 0) {
  tIn[v] = T++;
  prnt[v] = p;
  for (const int to : gr[v]) {
    if (to != p) {
      Dfs(to, v);
    }
  }
  tOut[v] = T++;
}
inline bool Upper(int a, int b) {
  return tIn[a] <= tIn[b] && tOut[a] >= tOut[b];
}
int Ask(char c, int x) {
  cout << c << ' ' << x << "\n";
  cout.flush();
  int res;
  cin >> res;
  return res - 1;
}
void Ans(int x) {
  cout << "C " << x << "\n";
  cout.flush();
}
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int t;
  cin >> t;
  while (t--) {
    T = 0;
    int n;
    cin >> n;
    setmy.clear();
    setli.clear();
    for (int i = 0; i < (n); ++i) {
      gr[i].clear();
    }
    for (int i = 0; i < (n - 1); ++i) {
      int a, b;
      cin >> a >> b;
      --a;
      --b;
      gr[a].push_back(b);
      gr[b].push_back(a);
    }
    int myk;
    cin >> myk;
    for (int i = 0; i < (myk); ++i) {
      cin >> myv[i];
      --myv[i];
      setmy.insert(myv[i]);
    }
    int lik;
    cin >> lik;
    for (int i = 0; i < (lik); ++i) {
      cin >> liv[i];
      --liv[i];
      setli.insert(liv[i]);
    }
    Dfs(0);
    int mint = INF;
    int minv = -1;
    for (int i = 0; i < myk; ++i) {
      if (mint > tIn[myv[i]]) {
        mint = tIn[myv[i]];
        minv = myv[i];
      }
    }
    int ansv = Ask('A', minv + 1);
    if (((setli).find(ansv) != (setli).end())) {
      Ans(minv + 1);
      continue;
    }
    int liansv = Ask('B', liv[0] + 1);
    if (((setmy).find(liansv) != (setmy).end())) {
      Ans(liansv + 1);
      continue;
    }
    if (!Upper(minv, liansv)) {
      Ans(-1);
      continue;
    }
    bool fl = false;
    for (int v = liansv; v != minv; v = prnt[v]) {
      if (((setmy).find(v) != (setmy).end())) {
        int u = Ask('A', v + 1);
        if (((setli).find(u) != (setli).end())) {
          Ans(v + 1);
          fl = true;
          break;
        } else {
          Ans(-1);
          fl = true;
          break;
        }
      }
    }
    if (!fl) {
      Ans(-1);
    }
  }
  return 0;
}
