#include <bits/stdc++.h>
using namespace std;
clock_t start;
void Time(bool timeIt) {
  if (!timeIt) return;
  clock_t end = clock();
  double elapsed_time = ((double)end - (double)start) / (double)CLOCKS_PER_SEC;
  fprintf(stderr, "Time elapsed = %0.4lf\n", elapsed_time);
}
bitset<200032> G[30], P;
int sp[200032], g[200032];
int main() {
  start = clock();
  int n, f;
  scanf("%d %d", &n, &f);
  for (int i = 1; i < 200032; ++i) sp[i] = (i % 2 ? i : 2);
  for (int i = 3; i * i < 200032; i += 2) {
    if (sp[i] != i) continue;
    for (int j = i * i; j < 200032; j += i) {
      if (sp[j] == j) sp[j] = i;
    }
  }
  for (int i = 2; i < 200032; ++i) {
    if (sp[i / sp[i]] == i / sp[i] and i != f) P[i] = 1;
  }
  for (int i = 1; i < 200032; ++i) {
    for (int j = 0; j < 30; ++j) {
      if (!G[j][i]) {
        g[i] = j;
        break;
      }
    }
    G[g[i]] |= (P << i);
  }
  int xors = 0;
  for (int i = 0; i < n; ++i) {
    int b, w, r;
    scanf("%d %d %d", &b, &w, &r);
    xors ^= (g[w - b] ^ g[r - w]);
  }
  if (xors)
    printf("Alice\nBob\n");
  else
    printf("Bob\nAlice\n");
  Time(true);
  return 0;
}
