#include <bits/stdc++.h>
using namespace std;
const int N = 200005, inf = 0x3f3f3f3f;
int read() {
  int f = 1, g = 0;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) g = g * 10 + ch - '0';
  return f * g;
}
int n, m, cnt, ans, len[N], a[N], pr[N], g[N], d;
bitset<N> f[100], h;
int main() {
  n = read();
  d = read();
  for (int i = 1; i <= n; i++) {
    int ta = read(), tb = read(), tc = read();
    len[i * 2 - 1] = tb - ta - 1;
    len[i * 2] = tc - tb - 1;
  }
  n *= 2;
  for (int i = 1; i <= n; i++) m = max(m, len[i]);
  a[1] = 1;
  for (int i = 2; i <= m; i++) {
    if (!a[i]) a[i] = pr[++cnt] = i;
    for (int j = 1; (j <= cnt) && (pr[j] <= a[i]) && (pr[j] * i <= m); j++)
      a[pr[j] * i] = pr[j];
  }
  for (int i = 2; i <= m; i++)
    if ((a[i] * a[i / a[i]] == i) && (i != d)) h[i] = 1;
  f[0] = h;
  for (int i = 1; i <= m; i++) {
    for (g[i] = 0; f[g[i]][i]; g[i]++)
      ;
    f[g[i]] |= h << i;
  }
  ans = 0;
  for (int i = 1; i <= n; i++) ans ^= g[len[i]];
  puts((ans) ? "Alice\nBob" : "Bob\nAlice");
  return 0;
}
