#include <bits/stdc++.h>
using namespace std;
int n, f;
bitset<200005> b[105], t;
int mn[200005], sg[200005], cnt, p[200005], ans;
void init() {
  for (int i = 2; i <= 200000; i++) {
    if (!mn[i]) p[++cnt] = i;
    if (!mn[i] || !mn[mn[i]]) t[i] = 1;
    for (int j = 1; j <= cnt && i * p[j] < 200000; j++) {
      mn[i * p[j]] = i;
      if (i % p[j] == 0) break;
    }
  }
}
int main() {
  cin >> n >> f;
  init();
  t[f] = 0;
  for (int i = 0; i <= 200000; i++) {
    while (b[sg[i]][i]) ++sg[i];
    b[sg[i]] |= t << i;
  }
  for (int i = 1; i <= n; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    ans = 0;
    ans ^= sg[b - a - 1] ^ sg[c - b - 1];
    if (ans)
      puts("Alice"), puts("Bob");
    else
      puts("Bob"), puts("Alice");
  }
  return 0;
}
