#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma comment(linker, "/stack:200000000")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
using matrix = vector<vector<long long>>;

typedef long long ll;
typedef long double ld;     
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;

template<typename T>
using kawaii_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define all(x) (x).begin(), (x).end()
//#define int ll

void FAST_IO() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //cout.setf(ios::fixed);
    //cout.precision(20);
}

const int MAXN = 2e5 + 10;
bool nprime[MAXN];
int gr[MAXN];
bitset<MAXN> good, g[100];

signed main() {
    FAST_IO();
    vector<int> primes;
    for (int i = 2; i < MAXN; ++i) {
        if (!nprime[i]) {
            primes.push_back(i);
            good[i] = 1;
        }
        if (i * 1ll * i >= MAXN) {
            continue;
        }
        for (int j = i * i; j < MAXN; j += i) {
            nprime[j] = true;
        }
    }
    for (int i = 0; i < primes.size(); ++i) {
        for (int j = i; j < primes.size(); ++j) {
            if (primes[i] * 1ll * primes[j] >= MAXN) {
                break;
            }
            good[primes[i] * primes[j]] = 1;
        }
    }
    for (int i = 0; i < MAXN; ++i) {
        for (int j = 0; ; ++j) {
            if (!g[j][i]) {
                gr[i] = j;
                break;
            }
        }
        g[gr[i]] |= (good << i);
    }
    int n, f;
    cin >> n >> f;
    good[f] = 0;
    int val = 0;
    for (int i = 0; i < n; ++i) {
        int a, b, c;
        cin >> a >> b >> c;
        val ^= gr[b - a - 1] ^ gr[c - b - 1];
    }
    cout << (val ? "Alice\nBob\n" : "Bob\nAlice\n");
    return 0;
}