#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2.5e5 + 100;
vector<int> temp;
vector<vector<int>> vect;
void fb(int pos, int tot) {
  if (pos == 5) {
    if (tot == 0) vect.push_back(temp);
    return;
  }
  for (int i = 0; i <= tot; i++) {
    temp.push_back(i);
    fb(pos + 1, tot - i);
    temp.pop_back();
  }
}
int contg;
int contdp;
int T[MAXN * 10][10];
int num[MAXN * 10];
int id(vector<int> &x, vector<int> &y) {
  int pt = 0;
  for (int i = 0; i < 5; i++) {
    pt = T[pt][x[i]];
  }
  for (int i = 0; i < 5; i++) {
    pt = T[pt][y[i]];
  }
  return num[pt];
}
vector<int> L[MAXN];
int outgree[MAXN];
int dp[MAXN];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  fb(0, 8);
  for (auto &x : vect) {
    for (auto &y : vect) {
      int pt = 0;
      for (int i = 0; i < 5; i++) {
        if (T[pt][x[i]] == 0) T[pt][x[i]] = ++contg;
        pt = T[pt][x[i]];
      }
      for (int i = 0; i < 5; i++) {
        if (T[pt][y[i]] == 0) T[pt][y[i]] = ++contg;
        pt = T[pt][y[i]];
      }
      num[pt] = ++contdp;
    }
  }
  for (auto x : vect) {
    for (auto y : vect) {
      int nodo = id(x, y);
      if (x[0] == 8 && y[0] == 8) {
        dp[nodo] = -1;
        continue;
      }
      if (x[0] == 8) {
        dp[nodo] = 1;
        continue;
      }
      if (y[0] == 8) {
        dp[nodo] = 2;
        continue;
      }
      for (int i = 1; i < 5; i++) {
        for (int j = 1; j < 5; j++) {
          if (x[i] && y[j]) {
            int val = (i + j) % 5;
            x[i]--;
            x[val]++;
            int v = id(y, x);
            L[v].push_back(nodo);
            outgree[nodo]++;
            x[i]++;
            x[val]--;
          }
        }
      }
    }
  }
  queue<int> Q;
  for (int i = 0; i < MAXN; i++) {
    if (outgree[i] == 0 && dp[i] != -1) {
      Q.push(i);
    }
  }
  while (Q.size()) {
    int nodo = Q.front();
    Q.pop();
    if (dp[nodo] == 0) dp[nodo] = 2;
    for (auto v : L[nodo]) {
      if (dp[v]) continue;
      if (dp[nodo] == 2) {
        dp[v] = 1;
        outgree[v]--;
        Q.push(v);
      }
      if (dp[nodo] == 1) {
        outgree[v]--;
        if (outgree[v] == 0) Q.push(v);
      }
    }
  }
  int T;
  cin >> T;
  while (T--) {
    int F;
    cin >> F;
    vector<int> v1(5), v2(5);
    for (int i = 0; i < 8; i++) {
      int n;
      cin >> n;
      v1[n]++;
    }
    for (int i = 0; i < 8; i++) {
      int n;
      cin >> n;
      v2[n]++;
    }
    string s1 = "Alice";
    string s2 = "Bob";
    if (F == 1) swap(v1, v2), swap(s1, s2);
    int ttt = id(v1, v2);
    if (dp[ttt] == 0) cout << "Deal" << '\n';
    if (dp[ttt] == 1) cout << s1 << '\n';
    if (dp[ttt] == 2) cout << s2 << '\n';
  }
  return 0;
}
