#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
const int oo = 1e9;
const int MOD = 1000000007;
vector<int> st;
int mv[80001], id = 0;
void gen(int idx, int val, int cc) {
  if (val < -1) return;
  if (idx == 8 && val == -1) {
    st.push_back(cc);
    mv[cc] = ++id;
    return;
  }
  for (int i = 0; i <= (8 - idx); ++i) {
    gen(idx + i, val - 1, cc * 10 + i);
  }
}
int pw[5], ans[510][510];
vector<pair<int, int> > g[510][510];
int sz[510][510];
int get(int idx, int msk) { return (msk / pw[idx]) % 10; }
int freq[8], t, f[8];
int convert(int a[]) {
  memset(freq, 0, sizeof freq);
  for (int i = 0; i < 8; ++i) {
    freq[a[i]]++;
  }
  int res = 0;
  for (int i = 0; i <= 4; ++i) {
    res += pw[i] * freq[i];
  }
  return res;
}
int main() {
  pw[0] = 1;
  for (int i = 1; i <= 4; ++i) {
    pw[i] = pw[i - 1] * 10;
  }
  queue<pair<int, int> > q;
  gen(0, 4, 0);
  for (int i = 0; i < st.size(); ++i) {
    for (int j = 0; j < st.size(); ++j) {
      if (st[i] == 8 && st[j] == 8) continue;
      if (st[j] == 8 || st[i] == 8) {
        if (st[i] == 8) ans[mv[st[i]]][mv[st[j]]] = 1;
        if (st[j] == 8) ans[mv[st[i]]][mv[st[j]]] = 2;
        q.push(make_pair(mv[st[i]], mv[st[j]]));
        continue;
      }
      for (int u = 1; u <= 4; ++u) {
        for (int v = 1; v <= 4; ++v) {
          if (!get(u, st[i]) || !get(v, st[j])) continue;
          int newC = (u + v) % 5;
          int newU = st[i] - pw[u] + pw[newC];
          g[mv[st[j]]][mv[newU]].push_back(make_pair(mv[st[i]], mv[st[j]]));
          sz[mv[st[i]]][mv[st[j]]]++;
        }
      }
    }
  }
  while (q.size()) {
    pair<int, int> cur = q.front();
    q.pop();
    for (int i = 0; i < g[cur.first][cur.second].size(); ++i) {
      pair<int, int> vv = g[cur.first][cur.second][i];
      if (ans[vv.first][vv.second]) continue;
      if (ans[cur.first][cur.second] == 2) {
        ans[vv.first][vv.second] = 1;
        q.push(vv);
        continue;
      }
      sz[vv.first][vv.second]--;
      if (sz[vv.first][vv.second] == 0) {
        ans[vv.first][vv.second] = 2;
        q.push(vv);
      }
    }
  }
  int p;
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &p);
    for (int i = 0; i < 8; ++i) {
      scanf("%d", &f[i]);
    }
    int a = convert(f);
    for (int i = 0; i < 8; ++i) {
      scanf("%d", &f[i]);
    }
    int b = convert(f);
    a = mv[a];
    b = mv[b];
    if (p == 0) {
      if (ans[a][b] == 1)
        puts("Alice");
      else if (ans[a][b] == 2)
        puts("Bob");
      else
        puts("Deal");
    } else {
      swap(a, b);
      if (ans[a][b] == 2)
        puts("Alice");
      else if (ans[a][b] == 1)
        puts("Bob");
      else
        puts("Deal");
    }
  }
  return 0;
}
