#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector")
#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 
#endif

#define df(b, e) ((b) > (e))
#define fore(i, b, e) for (auto i = (b) - df(b, e); i != e - df(b, e); i += 1 - 2 * df(b, e))
#define sz(x) int(x.size())
#define all(x) begin(x), end(x)
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
uniform_int_distribution<int> dis(1, 1000); 

typedef long long lli;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;

const int N = 2e5 + 5;
int n, f;
vector<int> P;
set<int> S;
bool sieve[N];
int mem[N];
bitset<N> B[505];
int timer = 0;

int grundy(int n) {
  if (n == 0)
    return 0;
  int &g = mem[n];

  if (g == -1) {
    ++timer;
    debug(timer);
    B[timer].set();

    for (int x : S) {
      if (x > n)
        break;
      if (n - x >= 0)
        B[grundy(n - x)] = 0;
    } 

    g = B[timer]._Find_first();
  }
  return g;
}

int main() {
  cin.tie(0)->sync_with_stdio(0), cout.tie(0);
  for (int i = 2; i * i < N; ++i) if (!sieve[i])
    for (int j = 2 * i; j < N; j += i)
        sieve[j] = 1;
  for (int i = 2; i < N; ++i)
    if (!sieve[i]) {
      P.pb(i);
      S.insert(i);
    }
  for (int i = 0; i < sz(P); ++i)
    for (int j = 0; j < sz(P) && P[i] * P[j] < N; ++j) {
      S.insert(P[i] * P[j]);
    }
  debug(sz(S));

  memset(mem, -1, sizeof mem);

  int win = 0;

  cin >> n >> f;
  if (S.count(f))
    S.erase(f);

  fore (i, 0, n) {
    int r, w, b;
    cin >> r >> w >> b;
    r += N, w += N, b += N;
    timer = 0;
    win ^= grundy(w - r - 1);
    timer = 0;
    win ^ grundy(b - w - 1);
    debug(win);
  }

  cout << (win ? "Alice\nBob\n" : "Bob\nAlice\n");
  return 0;
}