#include <bits/stdc++.h>
using namespace std;
int ans[500][500], st[500][500];
vector<pair<int, int> > go[500][500];
vector<vector<int> > cc;
vector<int> c;
int mv[1 << 20];
int it;
void pr(int n, int k) {
  if (k == 1) {
    c.push_back(n);
    mv[(((c[4] * 16 + c[3]) * 16 + c[2]) * 16 + c[1]) * 16 + c[0]] = it;
    cc.push_back(c);
    it++;
    c.pop_back();
    return;
  }
  for (int j = 0; j <= n; j++) {
    c.push_back(j);
    pr(n - j, k - 1);
    c.pop_back();
  }
}
int kkk[5] = {1, 16, 256, 4096, 65536};
void get_int(int &ans) {
  ans = 0;
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  while (c >= '0' && c <= '9') {
    ans = ans * 10 + c - '0';
    c = getchar();
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  pr(8, 5);
  queue<pair<int, int> > pp;
  for (int j = 0; j < cc.size(); j++) {
    vector<int> vv = cc[j];
    int cnum = (((vv[4] * 16 + vv[3]) * 16 + vv[2]) * 16 + vv[1]) * 16 + vv[0];
    bool ok = true;
    for (int q = 0; q < cc.size(); q++) {
      bool ok1 = true;
      for (int ii = 1; ii < 5; ii++) {
        if (cc[j][ii]) {
          ok = false;
          for (int jj = 1; jj < 5; jj++) {
            if (cc[q][jj]) {
              ok1 = false;
              cnum -= kkk[ii];
              cnum += kkk[(ii + jj) % 5];
              go[q][mv[cnum]].push_back(make_pair(j, q));
              st[j][q]++;
              cnum += kkk[ii];
              cnum -= kkk[(ii + jj) % 5];
            }
          }
          if (ok) {
            ans[j][q] = 1;
            pp.push(make_pair(j, q));
          } else if (ok1) {
            ans[j][q] = 2;
            pp.push(make_pair(j, q));
          }
        }
      }
    }
  }
  while (!pp.empty()) {
    int j = pp.front().first;
    int q = pp.front().second;
    pp.pop();
    for (auto v : go[j][q]) {
      if (ans[v.first][v.second]) continue;
      if (ans[j][q] == 2) {
        ans[v.first][v.second] = 1;
        pp.push(v);
        continue;
      }
      st[v.first][v.second]--;
      if (st[v.first][v.second] == 0) {
        ans[v.first][v.second] = 2;
        pp.push(v);
        continue;
      }
    }
  }
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    int f;
    cin >> f;
    int a = 0, b = 0;
    for (int j = 0; j < 8; j++) {
      int k;
      cin >> k;
      a += (1 << (k * 4));
    }
    for (int j = 0; j < 8; j++) {
      int k;
      cin >> k;
      b += (1 << (k * 4));
    }
    int k1 = mv[a], k2 = mv[b];
    if (f == 0) {
      if (ans[k1][k2] == 1) cout << "Alice" << '\n';
      if (ans[k1][k2] == 2) cout << "Bob" << '\n';
      if (ans[k1][k2] == 0) cout << "Deal" << '\n';
    } else {
      swap(k1, k2);
      if (ans[k1][k2] == 2) cout << "Alice" << '\n';
      if (ans[k1][k2] == 1) cout << "Bob" << '\n';
      if (ans[k1][k2] == 0) cout << "Deal" << '\n';
    }
  }
  return 0;
}
