#include <bits/stdc++.h>
using namespace std;
const int MAXN = 495;
map<vector<int>, int> mpid;
vector<int> state[495];
void gen(vector<int> v, int pos) {
  if (v[0] + v[1] + v[2] + v[3] + v[4] == 8) {
    int id = mpid.size();
    mpid[v] = id;
    state[id] = v;
    return;
  }
  for (int i = pos; i < 5; i++) {
    v[i]++;
    gen(v, i);
    v[i]--;
  }
}
vector<pair<int, int> > adj[MAXN][MAXN];
int deg[MAXN][MAXN];
int dp[MAXN][MAXN];
void precomp() {
  gen(vector<int>(5, 0), 0);
  memset((dp), (-1), sizeof(dp));
  for (int ia = 0; ia < MAXN; ia++) {
    for (int ja = 1; ja < 5; ja++) {
      if (state[ia][ja] == 0) {
        continue;
      }
      for (int ib = 0; ib < MAXN; ib++) {
        for (int jb = 1; jb < 5; jb++) {
          if (state[ib][jb] == 0) {
            continue;
          }
          vector<int> v = state[ia];
          v[ja]--;
          v[(ja + jb) % 5]++;
          int id = mpid[v];
          adj[ib][id].push_back({ia, ib});
          deg[ia][ib]++;
        }
      }
    }
  }
  memset((dp), (-1), sizeof(dp));
  queue<pair<int, int> > que;
  for (int i = 1; i < MAXN; i++) {
    dp[i][0] = 0;
    dp[0][i] = 0;
    que.push({i, 0});
    que.push({0, i});
  }
  while (!que.empty()) {
    int a = que.front().first, b = que.front().second;
    que.pop();
    int &ref = dp[a][b];
    if (ref < 0) {
      ref = 0;
    }
    for (pair<int, int> prv : adj[a][b]) {
      int pa = prv.first, pb = prv.second;
      if (deg[pa][pb] == 0) {
        continue;
      }
      deg[pa][pb]--;
      if (ref == 0) {
        dp[pa][pb] = 1;
        deg[pa][pb] = 0;
        que.push(prv);
      } else if (deg[pa][pb] == 0) {
        que.push(prv);
      }
    }
  }
}
int read() {
  vector<int> v(5);
  for (int i = 0; i < 8; i++) {
    int x;
    scanf("%d", &x);
    v[x]++;
  }
  return mpid[v];
}
int main() {
  precomp();
  int nq;
  for (scanf("%d", &nq); nq--;) {
    int fst;
    scanf("%d", &fst);
    int x = read();
    int y = read();
    if (fst == 0) {
      if (dp[x][y] == -1) {
        puts("Deal");
      } else if (dp[x][y] == 1) {
        puts("Alice");
      } else {
        puts("Bob");
      }
    } else {
      swap(x, y);
      if (dp[x][y] == -1) {
        puts("Deal");
      } else if (dp[x][y] == 1) {
        puts("Bob");
      } else {
        puts("Alice");
      }
    }
  }
}
