#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
template <class T, class U>
inline void Max(T &a, U b) {
  if (a < b) a = b;
}
template <class T, class U>
inline void Min(T &a, U b) {
  if (a > b) a = b;
}
inline void add(int &a, int b) {
  a += b;
  while (a >= 1000000007) a -= 1000000007;
}
int pow(int a, int b) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = ans * (long long)a % 1000000007;
    a = (long long)a * a % 1000000007;
    b >>= 1;
  }
  return ans;
}
int ans[500][500], d[500][500], sz;
map<vector<int>, int> g;
vector<vector<int> > st;
vector<int> e[500][500];
int main() {
  int T, j, i, k, ca = 0, m = 0, n, K;
  vector<int> v(5);
  for (v[0] = 0; v[0] < 9; v[0]++) {
    for (v[1] = 0; v[1] <= 8 - v[0]; v[1]++) {
      for (v[2] = 0; v[2] <= 8 - v[0] - v[1]; v[2]++) {
        for (v[3] = 0; v[3] <= 8 - v[0] - v[1] - v[2]; v[3]++) {
          v[4] = 8 - v[0] - v[1] - v[2] - v[3];
          g[v] = sz++;
          st.push_back(v);
        }
      }
    }
  }
  for (int i = 0; i < sz; i++) {
    v = st[i];
    for (int j = 1; j < 5; j++)
      if (st[i][j]) {
        v[j]--;
        for (int k = 0; k < sz; k++) {
          for (int l = 1; l < 5; l++)
            if (st[k][l]) {
              int first = (j + l) % 5;
              v[first]++;
              e[k][g[v]].push_back(i);
              d[i][k]++;
              v[first]--;
            }
        }
        v[j]++;
      }
  }
  queue<pair<int, int> > q;
  for (int i = 0; i < sz - 1; i++) {
    ans[i][sz - 1] = -1;
    q.push({i, sz - 1});
  }
  while (!q.empty()) {
    i = q.front().first, j = q.front().second;
    q.pop();
    if (ans[i][j] == -1) {
      for (auto &k : e[i][j]) {
        if (ans[k][i] == 0) {
          ans[k][i] = 1;
          q.push({k, i});
        }
      }
    } else {
      for (auto &k : e[i][j]) {
        --d[k][i];
        if (d[k][i] == 0) {
          ans[k][i] = -1;
          q.push({k, i});
        }
      }
    }
  }
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &k);
    int first, second;
    for (int l = 0; l < 2; l++) {
      for (int j = 0; j < 5; j++) v[j] = 0;
      for (int i = 0; i < 8; i++) {
        scanf("%d", &j);
        v[j]++;
      }
      if (l == 0)
        first = g[v];
      else
        second = g[v];
    }
    if (k == 0) {
      if (ans[first][second] == 0)
        puts("Deal");
      else if (ans[first][second] == 1)
        puts("Alice");
      else
        puts("Bob");
    } else {
      if (ans[second][first] == 0)
        puts("Deal");
      else if (ans[second][first] == 1)
        puts("Bob");
      else
        puts("Alice");
    }
  }
  return 0;
}
