#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
inline int s2i(int i0, int i1, int i2, int i3, int i4) {
  return i0 + 10 * i1 + 100 * i2 + 1000 * i3 + 10000 * i4;
}
inline int extract(int s, int i) {
  while (i--) s /= 10;
  return s % 10;
}
inline int replace(int s, int i1, int i2) {
  int mul = 1;
  for (int i = 0; i < 10; ++i, mul *= 10) {
    if (i == i1) s -= mul;
    if (i == i2) s += mul;
  }
  return s;
}
inline int encode(int p, int s1, int s2, const vi& state2ind) {
  return (p << 18) | (state2ind[s2] << 9) | state2ind[s1];
}
inline void decode(int s, int& p, int& s1, int& s2, const vi& states) {
  p = s >> 18;
  s1 = states[s & 0x1FF];
  s2 = states[(s >> 9) & 0x1FF];
}
inline int readstate() {
  int s = 0;
  for (int i = 0; i < 8; ++i) {
    int x;
    cin >> x;
    int mul = 1;
    while (x--) mul *= 10;
    s += mul;
  }
  return s;
}
inline int readquery(const vi& state2ind) {
  int f;
  cin >> f;
  int s1 = readstate();
  int s2 = readstate();
  return encode(f, s1, s2, state2ind);
}
void printstate(int s, const vi& states) {
  int p, s1, s2;
  decode(s, p, s1, s2, states);
  cout << p << " " << s1 << " " << s2;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  vi states;
  vi state2ind(100000, -1);
  for (int zeros1 = 0; zeros1 <= 8; ++zeros1) {
    for (int ones1 = 0; ones1 <= 8 - zeros1; ++ones1) {
      for (int twos1 = 0; twos1 <= 8 - zeros1 - ones1; ++twos1) {
        for (int threes1 = 0; threes1 <= 8 - zeros1 - ones1 - twos1;
             ++threes1) {
          int fours1 = 8 - zeros1 - ones1 - twos1 - threes1;
          int s = s2i(zeros1, ones1, twos1, threes1, fours1);
          state2ind[s] = states.size();
          states.push_back(s);
        }
      }
    }
  }
  const int N = 1 << 19;
  vi indeg(N);
  vvi revg(N);
  for (int s1 : states) {
    for (int s2 : states) {
      int v = encode(0, s1, s2, state2ind);
      for (int i1 = 1; i1 < 5; ++i1) {
        for (int i2 = 1; i2 < 5; ++i2) {
          int x1 = extract(s1, i1);
          int x2 = extract(s2, i2);
          if (x1 * x2 == 0) continue;
          int c = (i1 + i2) % 5;
          int w1 = encode(1, replace(s1, i1, c), s2, state2ind);
          int w2 = encode(0, s1, replace(s2, i2, c), state2ind);
          ++indeg[v];
          revg[w1].push_back(v);
          ++indeg[v | (1 << 18)];
          revg[w2].push_back(v | (1 << 18));
        }
      }
    }
  }
  vi finq;
  vi iswinning(N, 2);
  for (int s : states) {
    if (s == 8) continue;
    int s1 = encode(1, s, 8, state2ind);
    iswinning[s1] = 0;
    int s2 = encode(0, 8, s, state2ind);
    iswinning[s2] = 1;
    int s3 = encode(1, 8, s, state2ind);
    iswinning[s3] = 1;
    int s4 = encode(0, s, 8, state2ind);
    ;
    iswinning[s4] = 0;
    finq.push_back(s1);
    finq.push_back(s2);
    finq.push_back(s3);
    finq.push_back(s4);
  }
  vi knownc(N, 0);
  vi draws(N, 0);
  while (!finq.empty()) {
    int s = finq.back();
    finq.pop_back();
    int w1 = iswinning[s];
    for (int w : revg[s]) {
      if (iswinning[w] < 2 || knownc[w] == indeg[w]) continue;
      int t2 = w & (1 << 18);
      if (w1 == 2) ++draws[w];
      ++knownc[w];
      if (t2 && w1 == 0) {
        iswinning[w] = 0;
        finq.push_back(w);
      } else if (!t2 && w1 == 1) {
        iswinning[w] = 1;
        finq.push_back(w);
      } else if (knownc[w] == indeg[w]) {
        if (draws[w] > 0) {
          iswinning[w] = 2;
        } else if (t2) {
          iswinning[w] = 1;
        } else {
          iswinning[w] = 0;
        }
        finq.push_back(w);
      }
    }
  }
  int t;
  cin >> t;
  string outp;
  for (int i = 0; i < t; ++i) {
    int v = readquery(state2ind);
    int w = iswinning[v];
    if (w == 2)
      outp += "Deal\n";
    else if (w == 1)
      outp += "Alice\n";
    else if (w == 0)
      outp += "Bob\n";
    else
      assert(false);
  }
  cout << outp;
}
