#include <bits/stdc++.h>
using namespace std;
const int MAXN = 52500;
int pw[6], good[MAXN], wh[MAXN];
vector<int> v;
int in[500][500], win[500][500], los[500][500];
vector<pair<int, int> > g[500][500];
void gen(int pos, int rem, int x) {
  if (pos == 4)
    good[x + rem * pw[4]] = 1;
  else
    for (int j = 0, ThxDem = rem + 1; j < ThxDem; ++j)
      gen(pos + 1, rem - j, x + j * pw[pos]);
}
int get(int mk, int x) { return (v[mk] % pw[x + 1]) / pw[x]; }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  memset(wh, -1, sizeof(wh));
  pw[0] = 1;
  for (int i = 1, ThxDem = 6; i < ThxDem; ++i) pw[i] = pw[i - 1] * 9;
  gen(0, 8, 0);
  for (int i = 0, ThxDem = MAXN; i < ThxDem; ++i)
    if (good[i]) v.push_back(i), wh[i] = int(v.size()) - 1;
  for (int i = 0, ThxDem = int(v.size()); i < ThxDem; ++i)
    for (int j = 0, ThxDem = int(v.size()); j < ThxDem; ++j) {
      for (int x = 0, ThxDem = 5; x < ThxDem; ++x)
        for (int y = 0, ThxDem = 5; y < ThxDem; ++y)
          if (x * y && get(i, x) && get(j, y)) {
            int nx = v[i] - pw[x] + pw[(x + y) % 5];
            g[j][wh[nx]].push_back({i, j});
            in[i][j]++;
          }
      win[i][j] = -1;
    }
  queue<pair<int, int> > q;
  for (int i = 0, ThxDem = int(v.size()); i < ThxDem; ++i)
    for (int j = 0, ThxDem = int(v.size()); j < ThxDem; ++j)
      if (!in[i][j]) {
        if (i) q.push({i, j}), win[i][j] = 0;
        if (j) q.push({i, j}), win[i][j] = 1;
      }
  while (int(q.size())) {
    int i = q.front().first, j = q.front().second;
    q.pop();
    for (auto x : g[i][j]) {
      in[x.first][x.second]--;
      if (!win[i][j] && in[x.first][x.second] >= 0) {
        in[x.first][x.second] = 0;
        win[x.first][x.second] = 1;
        q.push({x.first, x.second});
      } else if (!in[x.first][x.second]) {
        win[x.first][x.second] = 0;
        q.push({x.first, x.second});
      }
    }
  }
  int t;
  cin >> t;
  while (t--) {
    int fl, me = 0, he = 0, xx;
    cin >> fl;
    for (int i = 0, ThxDem = 8; i < ThxDem; ++i) cin >> xx, me += pw[xx];
    for (int i = 0, ThxDem = 8; i < ThxDem; ++i) cin >> xx, he += pw[xx];
    me = wh[me];
    he = wh[he];
    if (fl) swap(me, he);
    int v = win[me][he];
    if (fl == 0) {
      if (v == 1) cout << "Alice\n";
      if (v == 0) cout << "Bob\n";
      if (v == -1) cout << "Deal\n";
    } else {
      if (v == 1) cout << "Bob\n";
      if (v == 0) cout << "Alice\n";
      if (v == -1) cout << "Deal\n";
    }
  }
}
