#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void smin(T &a, U b) {
  if (a > b) a = b;
}
template <typename T, typename U>
inline void smax(T &a, U b) {
  if (a < b) a = b;
}
template <typename T>
inline void gn(T &first) {
  char c, sg = 0;
  while (c = getchar(), (c > '9' || c < '0') && c != '-')
    ;
  for ((c == '-' ? sg = 1, c = getchar() : 0), first = 0; c >= '0' && c <= '9';
       c = getchar())
    first = (first << 1) + (first << 3) + c - '0';
  if (sg) first = -first;
}
template <class T, class T1>
inline void gn(T &first, T1 &second) {
  gn(first);
  gn(second);
}
template <class T, class T1, class T2>
inline void gn(T &first, T1 &second, T2 &z) {
  gn(first);
  gn(second);
  gn(z);
}
template <typename T>
inline void print(T first) {
  if (first < 0) {
    putchar('-');
    return print(-first);
  }
  if (first < 10) {
    putchar('0' + first);
    return;
  }
  print(first / 10);
  putchar(first % 10 + '0');
}
template <typename T>
inline void println(T first) {
  print(first), putchar('\n');
}
template <typename T>
inline void printsp(T first) {
  print(first), putchar(' ');
}
template <class T, class T1>
inline void print(T first, T1 second) {
  printsp(first), println(second);
}
template <class T, class T1, class T2>
inline void print(T first, T1 second, T2 z) {
  printsp(first), printsp(second), println(z);
}
int power(int a, int b, int m, int ans = 1) {
  for (; b; b >>= 1, a = 1LL * a * a % m)
    if (b & 1) ans = 1LL * ans * a % m;
  return ans;
}
int n;
int id[111111];
int st[500];
void calc(int k, int s, int val) {
  if (k == 5) {
    if (s == 8) id[val] = n, st[n] = val, n++;
    return;
  }
  for (int i = 0; s + i <= 8; i++) calc(k + 1, s + i, val * 10 + i);
}
int val[500][500], sz[500][500], now[500][500];
vector<pair<int, int> > rev[500][500];
int get(int *d) {
  int ans = 0;
  for (int i = 5; i--;) ans = ans * 10 + d[i];
  return ans;
}
queue<pair<int, int> > q;
void pre() {
  int d1[5], d2[5];
  for (int i = 0; i < n; i++) {
    for (int m = st[i], k = 0; k < 5; k++, m /= 10) d1[k] = m % 10;
    for (int j = 0; j < n; j++) {
      for (int m = st[j], k = 0; k < 5; k++, m /= 10) d2[k] = m % 10;
      for (int a = 0; a < 4; a++) {
        if (!d1[a + 1]) continue;
        for (int b = 0; b < 4; b++) {
          if (!d2[b + 1]) continue;
          int c = (a + 1 + b + 1) % 5;
          d1[a + 1]--;
          d1[c]++;
          sz[i][j]++;
          rev[j][id[get(d1)]].push_back(pair<int, int>(i, j));
          d1[a + 1]++;
          d1[c]--;
        }
      }
    }
  }
  memset(val, -1, sizeof(val));
  int winst = 8;
  int winid = id[winst];
  for (int i = 0; i < n; i++) {
    if (i == winid) continue;
    val[i][winid] = 0, val[winid][i] = 1;
    q.push(pair<int, int>(i, winid));
    q.push(pair<int, int>(winid, i));
  }
  while (!q.empty()) {
    pair<int, int> p = q.front();
    q.pop();
    if (val[p.first][p.second] == 0) {
      for (int i = 0; i < rev[p.first][p.second].size(); i++) {
        pair<int, int> to = rev[p.first][p.second][i];
        if (val[to.first][to.second] == -1) {
          val[to.first][to.second] = 1;
          q.push(to);
        }
      }
    } else {
      for (int i = 0; i < rev[p.first][p.second].size(); i++) {
        pair<int, int> to = rev[p.first][p.second][i];
        if (++now[to.first][to.second] == sz[to.first][to.second]) {
          val[to.first][to.second] = 0;
          q.push(to);
        }
      }
    }
  }
}
int cnt[2][5], ID[2];
int main() {
  calc(0, 0, 0);
  pre();
  int T;
  for (gn(T); T--;) {
    int fl;
    gn(fl);
    memset(cnt, 0, sizeof(cnt));
    for (int i = 0; i < 2; i++) {
      for (int j = 0; j < 8; j++) {
        int a;
        gn(a);
        cnt[i][a]++;
      }
      ID[i] = id[get(cnt[i])];
    }
    if (fl) swap(ID[0], ID[1]);
    if (val[ID[0]][ID[1]] == -1)
      puts("Deal");
    else if (val[ID[0]][ID[1]] == 1)
      puts(fl ? "Bob" : "Alice");
    else
      puts(fl ? "Alice" : "Bob");
  }
  return 0;
}
