#include <bits/stdc++.h>
using namespace std;
void dfs(vector<int> tree[], vector<int> &par, int cur, int prev) {
par[cur] = prev;
for (int nei : tree[cur]) {
if (nei != prev) {
dfs(tree, par, nei, cur);
}
}
}
void solve() {
int N;
cin >> N;
int a, b, c;
cin >> a >> b >> c;
a--; b--; c--;
vector<int> tree[N];
for (int i = 0; i < N - 1; i++) {
int u, v;
cin >> u >> v;
u--; v--;
tree[u].push_back(v);
tree[v].push_back(u);
}
vector<int> par(N);
dfs(tree, par, a, -1);
vector<int> marks(N, -1);
int cur = b;
int cnt = 0;
while (cur != -1) {
marks[cur] = cnt;
cur = par[cur];
cnt++;
}
cur = c;
cnt = 0;
int adist, bdist, cdist, center;
while (cur != -1) {
if (marks[cur] >= 0) {
bdist = marks[cur];
cdist = cnt;
center = cur;
break;
}
cur = par[cur];
cnt++;
}
cur = center;
adist = 0;
while (cur != a) {
adist++;
cur = par[cur];
}
if (adist < bdist && adist - 1 <= cdist) {
cout << "A\n";
} else if (bdist <= adist && bdist < cdist) {
cout << "B\n";
} else if (cdist <= bdist && cdist < adist - 1) {
cout << "C\n";
} else {
cout << "DRAW\n";
}
}
int main() {
cin.tie(0)->sync_with_stdio(0);
int T; cin >> T; while (T--) solve();
}